


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. In order to simplify the programming of graphical systems, ACUCOBOL-GT handles most events internally. The runtime 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 were 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 where a terminating event could occur, you must be ready to handle this exception value.
When a terminating event occurs, the runtime 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. For details on the EVENT STATUS data item, see section 4.2.3, Book 3,"Reference Manual."
For a description of the events that can be returned by the runtime, see Chapter 6, "Events Reference."