Quitting a Standalone

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am

Quitting a Standalone

Post by arkstar » Sun Oct 10, 2010 9:12 pm

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
Rob Glassman
ArkStar

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Quitting a Standalone

Post by WaltBrown » Sun Oct 10, 2010 10:22 pm

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
Walt Brown
Omnis traductor traditor

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am

Re: Quitting a Standalone

Post by arkstar » Mon Oct 11, 2010 1:03 pm

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
Rob Glassman
ArkStar

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Quitting a Standalone

Post by WaltBrown » Mon Oct 11, 2010 4:21 pm

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
Walt Brown
Omnis traductor traditor

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am

Re: Quitting a Standalone

Post by arkstar » Tue Oct 12, 2010 9:58 am

Hi Walt,

Thanks! That did it!

Rob
Rob Glassman
ArkStar

Post Reply