Windows Events and JADE Events

Each application running in JADE is executed on its own thread and each thread effectively runs as a standalone program. When an application is idle, it waits for the arrival of Windows messages generated as a result of some user action; for example, the use of the keyboard or mouse, a timer expiry, or a message such as a JADE notification posted to the application. Any window of the current application can generate messages that are to be acted upon.

When a message is received, JADE internally performs the appropriate processing and generates the required JADE event calls.

Many messages generate a sequence of actions that are executed as part of the original message; for example, a mouseDown event on an inactive form may also generate an activate event on the new form, a deactivate event and a mouseLeave event on the old form, a gotFocus event on the control gaining focus, and a lostFocus and a mouseLeave event on the control losing focus.

When a message has begun to be processed, no further messages can be executed until logic again does a read on the input message queue. (For the exceptions to this rule, see "Window, Form, and Control Events", earlier in this document.) The actions that generate a read of this message queue are as follows.

Timer and notification events are executed only when the application is waiting for input.

When the application is in one of the wait situations described in the previous list, any window can generate events and any notifications and timers are processed, except that when an exception box is displayed, all timer and notification events are delayed until the exception is aborted or canceled. Paint events are still executed, otherwise the forms and controls would not be repainted.

Showing a form (including a message box) as modal has the following impact only.

Some JADE events are generated immediately as a result of logic, as follows.

The JADE events that are generated immediately as a result of logic specifically do not include the following situations.

To reduce the complexity that can arise from generating these events immediately, it is your responsibility to handle these situations in your logic.

Call the Application class doWindowEvents method from a server method to process server notifications and timers.