What is the best practice to close procedure and corresponding gui?

I have a procedure which I am invoking manually by using prowin32.exe application.
Within this procedure I have several RUN statements to run another procedures.
All procedures from RUN statements are finished by RETURN statement.
Main procedure is finished by
Code:
APPLY "CLOSE" to this-procedure.
QUIT.
RETURN NO-APPLY.
but sometimes a GUI window remain open with message "press space to continue". If I press a space the GUI is closed.
Why is it happened that way? and how I can prevent it and have GUI closed automatically each single time without exceptions.

regards
 

KleineCuypie

New Member
Those windows are things that are displayed. Ain't that right?
I guess somewhere in your code you have written: "DISPLAY string".

Press space to continue is typical for a display window.

I don't know if I'm right. But maybe you can take a look for it.
 

RealHeavyDude

Well-Known Member
I think you are mixing different statements with different purposes: QUIT - will end the session. Any statement after QUIT is dead code. APPLY "CLOSE" TO THIS-PROCEDURE - will apply the close event to the THIS-PROCEDURE handle and thus remove the procedure from memory. RETURN NO-APPLY - is only useful if you want to discard the cause that invoked the procedure. Usually you would use this in a trigger. Therefore I would suggest you to use QUIT in the first procedure of the session and APPLY "CLOSE" TO THIS-PROCEDURE in all other procedures. Heavy Regards, RealHeavyDude.
 
Those windows are things that are displayed. Ain't that right?
I guess somewhere in your code you have written: "DISPLAY string".

Press space to continue is typical for a display window.

I don't know if I'm right. But maybe you can take a look for it.

No DISPLAY string in my code. The window is invoked every single time (or the graphical user interface is painted) because I am using a GUI application which is prowin32.exe.
 
I think you are mixing different statements with different purposes: QUIT - will end the session. Any statement after QUIT is dead code. APPLY "CLOSE" TO THIS-PROCEDURE - will apply the close event to the THIS-PROCEDURE handle and thus remove the procedure from memory. RETURN NO-APPLY - is only useful if you want to discard the cause that invoked the procedure. Usually you would use this in a trigger. Therefore I would suggest you to use QUIT in the first procedure of the session and APPLY "CLOSE" TO THIS-PROCEDURE in all other procedures. Heavy Regards, RealHeavyDude.

I changed the code according to your hint. Checking the results right now. Thanks.
 
This maybe goes without saying, but make sure you're running the code you think you are running. If you're clicking the red X to close the window, then the "Window-Close" trigger is being run. If you're clicking on an "Exit" or "Done" button you've added, then you're running THAT trigger code. You can put a message in each trigger before any other code to make sure. I believe what you're seeing is the result of running an APPLY-CLOSE when you want to run a QUIT. As RealHeavyDude said above, QUIT will end your session.
 
Top