pfc_Validation 事件编码示例

发布于 2024-09-05 10:51:34 字数 377 浏览 1 评论 0原文

您能给我一个如何在 pfc_Validation 事件中编码的示例吗?这是我从未使用过的事件。例如,这是我在 ue_itemchanged 事件中编码的内容。

if dwo.name = 'theme' then  
   This.Setitem(row,"theme",wf_clean_up_text(data))
end if

if dwo.name = 'Comments' then  
   This.Setitem(row,"Comments",wf_clean_up_text(data))
end if

pfc_Validation 事件中编码这些验证的正确方法是什么,以便它们仅在保存时执行?

Could you give me an example of the way I should code into the pfc_Validation event? This is an event that I have never used. For example here is something I have coded in the ue_itemchanged event.

if dwo.name = 'theme' then  
   This.Setitem(row,"theme",wf_clean_up_text(data))
end if

if dwo.name = 'Comments' then  
   This.Setitem(row,"Comments",wf_clean_up_text(data))
end if

Which is the proper way of coding those validations in the pfc_Validation event , so that they are performed only on save-time?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南冥有猫 2024-09-12 10:51:34

您正在询问本机 PowerBuilder 之外的问题,因此不能保证我的假设是正确的。 (例如,任何人都可以创建 pfc_Validation 事件,并在用户用鼠标画圆时触发该事件)有一个 pfc_Validation 事件编码为 PowerBuilder 基础类中逻辑工作单元 (LUW) 服务的一部分(PFC)。如果您想了解更多信息,我写了一篇文章 在 LUW 上。

首先,你的问题:LUW 服务中的所有内容都只会在保存时触发,所以你在那里状态良好。

话虽如此,从代码来看,这不是验证,而是为更新准备数据。在此基础上,我建议该逻辑的适当位置是 pfc_UpdatePrep。

至于转换代码,非常简单。 (现在,看我把事情搞砸了。)

FOR ll = 1 to RowCount()
   Setitem(ll,"theme",wf_clean_up_text(GetItemString (ll, "theme")))
   Setitem(ll,"comments",wf_clean_up_text(GetItemString (ll, "comments")))
NEXT

祝你好运,

特里。

You're asking something outside of native PowerBuilder, so there's no guarantee my assumptions are correct. (e.g. anyone could create a pfc_Validation event and have it fire when the user draws circles with his mouse) There is a pfc_Validation event coded as part of the Logical Unit of Work (LUW) service in PowerBuilder Foundation Classes (PFC). If you want to find out more about it, I've written an article on the LUW.

Firstly, your question: Everything in the LUW service is only fired at save time, so you're in good shape there.

Having said that, from the looks of the code, this isn't validation, but data preparation for the update. On that basis, I'd suggest the appropriate place for this logic is pfc_UpdatePrep.

As for converting the code, it's pretty simple. (Now, watch me mess it up.)

FOR ll = 1 to RowCount()
   Setitem(ll,"theme",wf_clean_up_text(GetItemString (ll, "theme")))
   Setitem(ll,"comments",wf_clean_up_text(GetItemString (ll, "comments")))
NEXT

Good luck,

Terry.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文