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.
Question 1: By returning 3 from
itemerror, you have rejected the data, which clears the column and triggers theitemchangedagain.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
itemchangedevent overridesitemerror. Initemchangedyou rejected the input and prevented focus changing; initemerroryou 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 theitemerrorevent, 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: