Powerbuilder:计算字段的更改是否会触发 itemchanged 事件
我在数据窗口中有一个名为 c_total_qty 的计算字段,它计算两个字段的乘法,一个字段是数据库列,第二个字段是另一个计算字段。
现在当c_total_qty
的值发生变化时,不会触发相应的itemchanged
事件。计算字段是这样工作的还是我的代码中有错误?如果计算域以这种方式工作,那么解决方法是什么?
I have a computed field called c_total_qty
in a datawindow which computes multiplication of two fields, one field is a database column and the second one is another computed field.
Now when c_total_qty
's value changes, it does not trigger corresponding itemchanged
event. Are computed fields work this way or there are errors in my code? If computed fields work this way, then what is the workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ItemChanged 是关于通过 UI 进行的更改,因此根据我对您情况的描述的了解,不,它不会因 c_total_qty 更改而触发。
至于解决方法,我想问题是更改的根源是 UI 数据输入还是编程值更改。如果这是根值之一的 UI 更改,您仍然可以挂钩 ItemChanged,但查找正在更改的根列。如果是编程更改,我可能会创建一个自定义用户事件,并从以编程方式更改根值的任何位置调用它。 (事实上,我可能会建议在这两种情况下使用自定义用户事件,在第一种情况下从 ItemChanged 调用自定义用户事件,以便您准备好干净地处理这两种情况。)
祝你好运,
Terry。
ItemChanged is all about changes made through the UI, so from what I understand of your description of your situation, no, it won't fire for c_total_qty changes.
As for a work around, I guess the question is whether the root of the change is in a UI data entry or a programmatic value change. If this is a UI change of one of the root values, you can still hook in ItemChanged, but look for the root column being changed. If it's a programmatic change, I'd probably create a custom user event and call it from wherever the root value is being programmatically changed. (In fact, I'd probably recommend a custom user event in both cases, calling the custom user event from ItemChanged in the first case, so that you're ready to handle both situations cleanly.)
Good luck,
Terry.