Progress
Language Tutorial
for Character


Event Types

Earlier, the tutorial defined any user input as an event. All keystrokes are events. All mouse interactions are events. It’s time to expand the definition of events. Progress recognizes two types of events: event actions and event functions. An event action is any simple user interaction, like a single keystroke or a simple mouse interaction. An event function is an abstraction of one or more event actions.

For example, on some platforms F1 invokes the help system. On other platforms F2 invokes the help system. F1 and F2 are both event actions, but both invoke the same function (in this example). Instead of writing code for the event action, you can write equivalent code using the Progress keyword that specifies the function. In this case, the keyword is HELP. HELP is an event function:

ON F1 OF widget-name
DO:
    /* Code */
END.

ON HELP OF widget-name
DO:
    /* Code */
END. 

The first trigger relies on the event action, while the second trigger relies on the event function. For any particular widget, you can write a trigger for either the event action or the event function, but not for both. However, you should write your triggers for event functions wherever possible because:

For these reasons, this tutorial uses only event functions.

For every type of widget, Progress has a default response for every event that the widget can receive. This means that when you display widgets, Progress takes care of much of the normal activity the user would have with a widget. The events that you want to keep track of explicitly are those that:

You’ve already seen the syntax for the ON statement, which handles events that execute trigger code. Now, examine this partial syntax for the WAIT-FOR statement.

SYNTAX
WAIT-FOR event-list OF widget-list
  [ OR event-list OF widget-list ] ... 

The WAIT-FOR statement translates to “on this widget-event pair, unblock execution.” The result is that the user moves into another part of the procedure or completes the procedure.

Important Event Functions

Table 3–3 defines some important event functions that you’ll use frequently.

Table 3–3: Important Event Functions 
Function
Description
ENTRY
Any action by the user or the application that gives a widget input focus.
LEAVE
Any action by the user or the application that takes input focus from a widget.
GO
Any action that signals Progress to accept new data and continue processing.
CHOOSE
Any action that chooses a button or menu item.

Event Categories

There are literally hundreds of events, so the Progress documentation uses some terms to refer to groups of related events. Table 3–4 describes the categories.

Table 3–4: Event Categories 
Category
Description
Universal key functions
These events are “universal” to all widgets, except menu widgets. They tend to be basic event functions, like GO or HELP.
Navigation key functions
These events are the keystrokes that let you move input focus in an interface, like TAB or BACK-TAB.
Field-editing key functions
These events are the keystrokes that let you manipulate text inside a widget, like BACKSPACE or DELETE.
High-level Progress event functions
These are the most important event functions in Progress, like LEAVE and ENTRY. They represent the easiest way to connect triggers with widgets. For the most part, the tutorial uses high-level events because they make readable, portable code.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095