Using event procedures
- Last Updated: August 23, 2021
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Using event procedures
The AppBuilder provides definition templates for event
procedures through the Triggers section of the Section Editor. (For
more information, see Handling events.)
In this application, the CSSpin control's SpinUp and SpinDown events
are caught to advance or backup in the list of Customer records.
These events also increment (SpinUp) or decrement (SpinDown) the
spin button control Value property, which the application displays
in the iRecordCount field.
This is the event procedure for the SpinUp event:
|
As you hold down the right-arrow button of the control, the control generates continuous SpinUp events. For each such event, this procedure reads the next query record and displays it. However, if the procedure tries to read beyond the last record in the query, it resets max-records to 1 less than the current Value property setting (the last record count).
It also resets the Value property to 1, wrapping around and restarting the upward query scan at the first record. Thus, the user can scan upward continuously through the query without reversing direction.
NUM-RESULTS from
the query is initially returned. However, note that the value might
be inaccurate if records are deleted after the user encounters them.
So, this is not a perfect solution.This is the event procedure for the SpinDown event. As you hold down the left-arrow button of the control, the control generates continuous SpinDown events. For each such event, this procedure reads the previous query record and displays it. However, if the procedure tries to read before the first record in the query, it resets the current Value property setting to the known count of the last record in the query and restarts the downward query scan at the last record. For example:
|
Thus, the user can scan downward continuously through the query without reversing direction.