The basic browse events include:

  • VALUE-CHANGED — Occurs each time the user selects or deselects a row. Note that the event name is slightly misleading in that it is not meant to imply that the value of the data in the row has been modified, only that a different row has been selected.
  • HOME — Occurs when the user repositions the browse to the beginning of the query’s result set by pressing the HOME key.
  • END — Occurs when the user repositions the browse to the end of the query’s result set by pressing the END key.
  • OFF-END and OFF-HOME — Occur when the user uses the vertical scrollbar or arrow keys to scroll all the way to the end or the top of the browse.
  • DEFAULT-ACTION — Occurs when the user presses RETURN or ENTER or when the user double-click a row. DEFAULT-ACTION also has the side effect of selecting the row that is currently highlighted.
  • SCROLL-NOTIFY — Occurs when the user adjusts the scrollbar

Typically, you use VALUE-CHANGED and DEFAULT-ACTION to link your browse to other parts of your application. Your current test window contains an example of the use of VALUE-CHANGED. When the current row in the Order browse is changed, the VALUE-CHANGED event occurs, and the trigger executes to retrieve its OrderLines and to display them in the second browse.

The DEFAULT-ACTION event occurs when the user explicitly selects a row not just by positioning to it, but by either double-clicking it or pressing ENTER.

To define a DEFAULT-ACTION trigger for the Order browse:

  1. In the Section Editor, select the Triggers section and the OrderBrowse object.
  2. Click the New button and select DEFAULT-ACTION from the list of browse events.
  3. Enter this MESSAGE statement for the event:
    DO:
      MESSAGE "This Order's SalesRep is " Order.SalesRep SKIP
        "and the terms are " Order.Terms VIEW-AS ALERT-BOX.
    END.
  4. Run the window procedure and double-click on one of the Order rows. The following message appears:

The SCROLL-NOTIFY event is important if you want to be notified whenever the position of the rows of data within the browse viewport has changed by a scrolling action.

You could use the OFF-END or OFF-HOME event to retrieve more data to all the rows in the browse’s query, for example, when there are too many rows to retrieve at once. Note that if the user scrolls by clicking and holding the up or down arrows at the bottom and top of the vertical scrollbar, the OFF-HOME or OFF-END event does not occur until the user releases the mouse key.