In graphical systems, events communicate actions taken by the user and various graphical objects. For example, if the user types a key, the system may generate several events to denote that fact: a key pressed event, a character typed event, and a key released event. A push button might generate a button pushed event when the user activates it. Much of graphical programming involves detecting and handling events.

Event programming is foreign to most COBOL programs. To simplify the programming of graphical systems, ACUCOBOL-GT handles most events internally. The run-time system either performs the appropriate action, or converts the event into a form more recognizable to a traditional COBOL program. For example, you can create your push buttons so that button pushed events are treated as if a particular function key was pressed.

Certain events must be handled by the program, however. In ACUCOBOL-GT, there are very few of these, but they are important. Events that must be acted upon by the COBOL program are called terminating events. The name comes from the fact that their occurrence causes any active ACCEPT statement to terminate, so that the COBOL program can handle the event.

When a terminating event occurs, any active ACCEPT statement terminates and returns an exception value of "96". In the file acugui.def, you will find a level 78 for this value, called W-EVENT. When you set up a situation in which a terminating event could occur, you must be ready to handle this exception value.

When a terminating event occurs, the run-time system fills in the new EVENT STATUS data item (event-status) with information about the event. The EVENT STATUS data item is declared in SPECIAL-NAMES. This data item identifies which event occurred, which window it occurred in, which control it applies to (if any), and any additional information your program might need. See Special-Names Paragraph for details on the EVENT STATUS data item.

If desired, for any control that generates events you can specify a list of event types that that control either must receive or not receive (filter out). To create such a list, you use the EVENT-LIST, AX-EVENT-LIST, and EXCLUDE-EVENT-LIST Common Properties. These are described in Common Screen Options.

For a description of the events that can be returned by the runtime system, see Events Reference.

Note: There is a special control style called SELF-ACT that can be assigned to push buttons, radio buttons, and check boxes. This style simplifies the handling of button events. If you also assign an exception value to the button, it will act just like the equivalent function key. See Push Button for more information about the SELF-ACT style.