Consultor Eletrônico



Kbase P21216: The 'One Session one WAIT-FOR' golden rule
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/1/2007
Status: Verified

GOAL:

What is the "One Session one WAIT-FOR" golden rule?

GOAL:

Multiple windows with multiple WAIT-FOR statements

FACT(s) (Environment):

Progress/OpenEdge Versions
All Supported Operating Systems

FIX:

Many problems can occur when managing multiple windows with multiple WAIT-FOR statements in one session.

The purpose of this rule is to not have to worry about nesting correctly multiple WAIT-FOR's. Multiple WAIT-FOR are necessary only when there is a need to force a sequential RUN, by stopping the flow of the Program(s).

Easiest to apply this rule is to run children window procedures persistently as shown bellow:

/* in ParentWindow.w*/
RUN ChildWindow.w PERSISTENT.


In ChildWindow.w, see the importance of the following line that come by default in the main block of the window template:

IF NOT THIS-PROCEDURE:PERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.

Since the ChildWindow.w procedure is running persistently, the WAIT-FOR will not occur and the flow of the program will go back to parentWindow.w (after RUN ChildWindow.w PERSISTENT.)


Indeed, the second window does not require a WAIT-FOR to be alive and make its contained widgets and itself sensitive. The default window template works in such a way that the persistent procedure will be deleted by the disable_UI procedure when the WINDOW-CLOSE event is fired for the window widget.