Define user interface events
- Last Updated: January 16, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
The CHOOSE event is the one you want to capture. An event is an action that
happens while the application is running that the AVM can intercept for you. Some events
are associated with particular kinds of user interface objects, such as the
CHOOSE event for a button. Others are defined for mouse clicks and
other mouse events.
To define an event for the button:
- Click the New button in the Section
Editor to see a list of all the events that you can define for the
current object:
The
CHOOSEevent is the most common event for a button, so that is the event the Section Editor offers you by default. - Click Cancel to exit the Choose Event dialog box and return to the Section Editor.
- In the Section Editor, press CTRL+V or select the
menu item to paste the code you copied from the
enable_UIprocedure into your trigger.
To go back and get the statement that opens the Order query for you:
- Reselect the
enable_UIprocedure. You can do this by selecting Procedures from the Section type list. Or you can click the List button, which brings up a list of all editable sections:
- Copy the statement
{&OPEN-BROWSERS-IN-QUERY-CustQuery}fromenable_UI, go back to your trigger block, and paste it at the end of the block:
This is the code that repositions to the first
Customer, displays it, and opens a query to display itsOrders.
To repeat these steps for a Next button:
- Click the Button icon on the Palette.
- Drop another button onto your design window next to the First button.
- Rename the object to BtnNext and change its label to Next.
- Copy the block of code from the First button and paste it into the same section for the Next button.
- Change the first statement to
GET NEXT CustQuery. This advances to the next record in the set ofCustomersin New Hampshire when you click the button. - Save your procedure by selecting or by clicking the Save icon in the AppBuilder toolbar, and then rerun it.
Now you should be able to walk through the New Hampshire Customers. As
you display each one by clicking the Next button, you see that
its Orders are displayed in the browse.
To finish adding buttons to your window:
- Add two more buttons to your window called BtnPrev and BtnLast, with the labels Prev and Last.
- Copy the same block of code into the trigger sections for these two buttons.
- Change the
GET FIRSTstatement toGET PREVfor theBtnPrevtrigger, and toGET LASTfor theBtnLasttrigger.