PROCESS_EVENTS {,ERR=lineref}
The PROCESS_EVENTS verb continually processes user interface events.
If the callback subroutine registered to handle the event is invalid, an !ERROR=21 is returned.
In BBj 5.0 and higher, the Process Events verb supports an optional error branch.
The following rules determine the dispatch of events from the server’s event queue:
1. If a control has been destroyed, the event is discarded.
2. If a control’s callback has been unregistered for an event, the event is discarded.
3. If a control’s callback does not exist in the program, an error is thrown.
4. Otherwise, the event is read off the queue, and if processing events, the callback is
executed.
A BBj program may use both PROCESS_EVENTS and READ RECORD styles of event handling, either by nesting a READ RECORD within a CALLBACK routine or be calling another BBj program which uses a different event style.
When a program switches between event handling styles, the event and notify queues are emptied. In other words, when a program that was currently using PROCESS_EVENTS style calls READ RECORD, the event and notify queues are emptied. Conversely, when a program that was currently using READ RECORD calls PROCESS_EVENTS the event and notify queues are emptied.
An example of a menu program using either event style calling a program utilizing either event style follows. The example programs below expect an argument of either of the following:
|
- rr |
READ RECORD |
|
- pe |
PROCESS_EVENTS |
|
REM Using both READ RECORD and PROCESS_EVENTS interchangeably |
|
REM Program to be demonstrate using both event styles from a menu |