Consultor Eletrônico



Kbase 21101: ADM2. Programatically Closing Persistent Window From Its Parent
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/17/2004
Status: Unverified

GOAL:

How to close a persistent window from its parent window.

GOAL:

Programatically Closing Persistent Window From Its Parent

FACT(s) (Environment):

Progress 9.x
OpenEdge 10

FIX:

A persistent procedure remains in memory until you explicitly delete it. Typically the AppBuilder-generated Internal procedure, disable_UI, handles the delete of the persistent procedure. In your program you can APPLY "CLOSE" to a procedure or handle. This causes the AppBuilder-generated ON CLOSE trigger to fire, which runs the disable_UI procedure containing the actual delete.
It is a good idea to bundle all shutdown activity in the APPLY "CLOSE". This allows others to run your program and apply a consistent shutdown mechanism.

Applying an Event -- The AppBuilder applies the CLOSE Event, rather than deleting the procedure directly.
Make sure that you explicitly delete the child window when you close the parent, otherwise it will remain in memory.

Example:

-- In the Parent Window

/* Trigger Block* /
ON CHOOSE OF BTN-DONE DO:
APPLY "CLOSE" TO THIS_PROCEDURE.
END.

/* Main Block */
ON CLOSE OF THIS-PROCEDURE DO:
IF VALID-HANDLE(hOrderline) THEN
APPLY "CLOSE" TO hOrderline.
RUN disable_UI.
END.
-- In the Child Window

/* Main Block */
ON CLOSE OF THIS-PROCEDURE DO:
RUN DISABLE_UI.
END.
Note: The disable_UI routine performs a conditional check for a persistent procedure, returns a TRUE, and executes a DELETE Statement.

/* Procedure disable_UI */
IF THIS-PROCEDURE:PERSISTENT THEN
DELETE PROCEDURE THIS-PROCEDURE.