Try OpenEdge Now
skip to main content
ABL Reference
Handle-based Object Events Reference : Applying events
 

Applying events

You can apply any event to any widget using the APPLY statement. Depending on the event-widget pair, the APPLY statement may or may not perform the default system action. Regardless of whether there is a default system action associated with an event-widget pair, you can write a trigger for the pair. The APPLY statement executes a trigger associated with an event-widget pair. If the event-widget pair has a default system action, that action occurs before or after the trigger executes, depending on the event.
The APPLY statement also serves as a communications/dispatch mechanism between procedures in an application. You can define a trigger for an event-procedure pair. For example:
ON CLOSE OF THIS-PROCEDURE DO:
  APPLY "CLOSE" TO WINDOW-1.
END.
To define a trigger for a procedure, specify any ABL event in an ON statement for a procedure handle. This capability allows you to encapsulate functionality in a procedure. To access that functionality, simply use the APPLY statement to apply the appropriate event to the handle of the procedure. For more information, see the APPLY statement reference entry.
When working with browse widgets, you can apply events to the browse widget and to a browse cell in the currently focused row. For example:
ON CHOOSE OF button1 DO:
APPLY "ENTRY" TO my-browse IN FRAME a.
/* Code to focus a particular row in the browse. */
APPLY "ENTRY" TO column3 IN BROWSE my-browse.
END.
Since a browse cell is the intersection of a column and row, referencing the column name references the intersection of that column and the currently focused row.
Note: The most flexible technique for encapsulating functionality in a procedure is to define and call internal procedures of a persistent procedure.