Coding the ItemChanged event
If data passes conversion and validation, the ItemChanged
event is triggered. By default, the ItemChanged event accepts the
data value and allows focus to change. You can write code for the
ItemChanged event to do some additional processing. For example,
you could perform some tests, set a code to reject the data, have
the column regain focus, and trigger the ItemError event.
Example
The following sample code for the ItemChanged event for a
DataWindow control called dw_Employee sets the return code
in dw_Employee to reject data that is less than the employee’s
age, which is specified in a SingleLineEdit text box control in
the window.
This is the PowerBuilder version of the code:
1 |
int a, age |
1 |
age = Integer(sle_age.text) |
1 |
a = Integer(data) |
1 |
1 |
// Set the return code to 1 in the ItemChanged |
1 |
// event to tell PowerBuilder to reject the data |
1 |
// and not change the focus. |
1 |
IF a < age THEN RETURN 1 |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest