关于 itemchanged 和 itemerror 事件的两个问题
PB6.5.1和PB9.0内:
问题1: 在 itemchanged 事件中: 返回1 在 itemerror 事件中: 返回3 在运行时,触发事件的顺序是: itemchanged-->itemerror-->itemchanged-->itemerror 为什么每个事件都会触发两次?
问题2: 在 itemchanged 事件中: 返回1 在 itemerror 事件中: 返回2 在运行时,焦点没有移动到下一个单元格。 为什么?
谢谢。
Within PB6.5.1 and PB9.0:
Question 1:
In itemchanged event:
return 1
In itemerror event:
return 3
At runtime,the sequence of events fired is:
itemchanged-->itemerror-->itemchanged-->itemerror
Why is each event fired twice?
Question 2:
In itemchanged event:
return 1
In itemerror event:
return 2
At runtime,the focus did not move to the next cell.
Why?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题 1: 通过从
itemerror
返回 3,您已拒绝数据,这会清除该列并再次触发itemchanged
。至于为什么 PowerBuilder 被设计成以这种方式工作,我怀疑他们认为这会遵循最不意外的原则,即他们预计人们会问为什么拒绝输入不会触发
itemchanged
。问题 2:
itemchanged
事件覆盖itemerror
。在itemchanged
中,您拒绝了输入并阻止了焦点更改;在itemerror
中,您现在接受输入,但尚未删除焦点更改时的阻止。您应该从itemchanged
返回 2,因为您可以通过返回 1 或 3 来控制是否允许从itemerror
事件更改焦点。以防有人正在阅读本文没有方便的 powerbuilder 帮助文件的问题:
返回
itemchanged
的值:itemerror
的返回值:Question 1: By returning 3 from
itemerror
, you have rejected the data, which clears the column and triggers theitemchanged
again.As to philosophically why PowerBuilder is designed to work in this fashion, I suspect they thought it would follow the principal of least surprise i.e. they were anticipating people asking why rejecting the input did not trigger
itemchanged
.Question 2: The
itemchanged
event overridesitemerror
. Initemchanged
you rejected the input and prevented focus changing; initemerror
you now accept the input, but you have not removed the block on focus changing. You should return 2 fromitemchanged
, since you can then control whether you allow focus to change from theitemerror
event, by returning either 1 or 3.In case anyone is reading this question without the powerbuilder help files handy:
return values for
itemchanged
:return values for
itemerror
: