Page 1 of 1

Quitting a Standalone

Posted: Sun Oct 10, 2010 9:12 pm
by arkstar
If you click on the "Close" button of the window of a standalone, the program is stil residing in memory.
I have added an "Exit" button which does destroy the stack, but I was wondering if there is a way to code the "Close" or "X" button of the window?

Thanks in advance
Rob

Re: Quitting a Standalone

Posted: Sun Oct 10, 2010 10:22 pm
by WaltBrown
Hi!
In the Dictionary, the message "closeStackRequest" appears to be sent when the Close button in the title bar is clicked. The dictionary entry says it is also sent when the File->Close menu item is selected, but there is a comment indicating that is not true.
Walt

Re: Quitting a Standalone

Posted: Mon Oct 11, 2010 1:03 pm
by arkstar
Thanks for your response,

I added this code to my card:

on closeStackRequest
answer "Are you sure?" with "No" or "Yes"
if it is "Yes" then
pass closeStackRequest
set the destroyStack of this stack to true
quit
end if
end closeStackRequest

I used the code I have in my "Exit" button, but while this closes the window with the dialog box, it still does not remove it from memory, BUT, it does remove it from memory when executed from the "Exit" button.

Any ideas?

Thanks again!
Rob

Re: Quitting a Standalone

Posted: Mon Oct 11, 2010 4:21 pm
by WaltBrown
I would be careful where the "pass" is in the handler, see this from the Dictionary:

"Stops the current handler and passes the message to the next object in the message path."

It appears that "pass" should be the last statement, and the "quit" would be superfluous (but I haven't specificly tested this).
Walt

Re: Quitting a Standalone

Posted: Tue Oct 12, 2010 9:58 am
by arkstar
Hi Walt,

Thanks! That did it!

Rob