Add APPLY statements to the procedure
- Last Updated: December 19, 2023
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
This section provides an example of how you can use the APPLY statement to
cause an event.
To add an APPLY statement to your test window procedure:
- Add the code in bold to the main block of the window procedure:
MAIN-BLOCK: DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK: RUN enable_UI. APPLY "VALUE-CHANGED" TO OrderBrowse. IF NOT THIS-PROCEDURE:PERSISTENT THEN WAIT-FOR CLOSE OF THIS-PROCEDURE. END.The
APPLYstatement causes an event to happen programmatically, just as the user action of clicking on a browse row would cause the event. Now the event is fired when the window first comes up. - Add the same
APPLYstatement to each of the four trigger blocks for the First, Prev, Next, and Last buttons, after theOrderquery is opened. For example:DO: GET NEXT CustQuery. IF AVAILABLE Customer THEN DO: DISPLAY Customer.Name Customer.CustNum Customer.Address Customer.City Customer.State WITH FRAME CustQuery IN WINDOW CustWin. {&OPEN-BROWSERS-IN-QUERY-CustQuery} APPLY "VALUE-CHANGED" TO OrderBrowse. END. /* END DO IF AVAILABLE Customer */ END.
Now the event is fired each time there is a different Customer, when the
Order query is reopened.
It would be helpful to have this behavior become a part of every navigation button
automatically so that you did not have to enter this line of code all over the place.
For now your modified window procedure should work properly in all the places where the
VALUE-CHANGED event must occur.