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:

  1. 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 CHOOSE event is the most common event for a button, so that is the event the Section Editor offers you by default.

  2. Click Cancel to exit the Choose Event dialog box and return to the Section Editor.
  3. In the Section Editor, press CTRL+V or select the menu item Edit > Paste to paste the code you copied from the enable_UI procedure into your trigger.

To go back and get the statement that opens the Order query for you:

  1. Reselect the enable_UI procedure. 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:
  2. Copy the statement {&OPEN-BROWSERS-IN-QUERY-CustQuery} from enable_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 its Orders.

To repeat these steps for a Next button:

  1. Click the Button icon on the Palette.
  2. Drop another button onto your design window next to the First button.
  3. Rename the object to BtnNext and change its label to Next.
  4. Copy the block of code from the First button and paste it into the same section for the Next button.
  5. Change the first statement to GET NEXT CustQuery. This advances to the next record in the set of Customers in New Hampshire when you click the button.
  6. Save your procedure by selecting File > Save 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:

  1. Add two more buttons to your window called BtnPrev and BtnLast, with the labels Prev and Last.
  2. Copy the same block of code into the trigger sections for these two buttons.
  3. Change the GET FIRST statement to GET PREV for the BtnPrev trigger, and to GET LAST for the BtnLast trigger.