EVENT Processing in the Screen Section



January 2, 2001

EXCEPTION procedure executes, the program is no longer (or is not yet) inside of the graphical control. When an EVENT procedure executes, the program stays within the graphical control.

According to Acucorp's Chief Scientist, Drake Coker, the reason that EVENT procedures follow different rules has to do with where they are in the system architecturally. The other embedded procedures (BEFORE, AFTER and EXCEPTION) are attached to the Screen Section where they are declared. They only affect the behavior of the Screen Section and can use SCREEN-CONTROL to modify the way a Screen Section works.

EVENT procedures are not part of the Screen Section, they are part of the control itself. In fact, you can place an EVENT procedure on a control that is not part of a Screen Section."

Here is a picture of how Screen Sections are processed during ACCEPT:

 --------------------------       -------------------------
 [screen section processor]<------[ACCEPT-CONTROL examined]
 --------------------------       -------------------------
            |                                  ^
            v                                  |
-----------------------------     -------------------------
[screen section field accept]---->[AFTER/EXCEPTION handler]
-----------------------------     -------------------------
            |
            v
-----------------------       ---------------
[ACCEPT control-handle]<----->[EVENT handler]
-----------------------       ---------------

The middle layer calls the AFTER/EXCEPTION procedure when the bottom layer terminates. After the AFTER/EXCEPTION procedure terminates, ACCEPT-CONTROL is examined to determine what to do next (e.g., go to another field or terminate the top-level ACCEPT).

Playing with ACCEPT-CONTROL from inside an EVENT procedure has no useful effect because the initialization code for the AFTER/EXCEPTION procedure set ACCEPT-CONTROL to "0", so even if the control terminates immediately after the EVENT procedure, the value set by the user is lost.

EVENT procedures can affect the action of the control by setting EVENT-ACTION to various values (these are described in the manual).

There is no direct way for an EVENT procedure to affect the behavior of a Screen Section. However, you can generally produce various effects by using EVENT-ACTION to cause the control to terminate with an exception. You can then use an EXCEPTION procedure to detect this exception and act accordingly.

Your Session will expire in 90 minutes
Notification will be shown in:
600 seconds