Page 1 of 1
'Close this stack' closes all stacks
Posted: Sun May 03, 2015 4:55 pm
by croivo
I have custom answer dialog box (or substack) with this code on button:
Code: Select all
on mouseUp
close this stack
end mouseUp
But when I click on that button, all stacks of the program are closing (it should close only that 1 substack!). I'm using Windows.
Re: 'Close this stack' closes all stacks
Posted: Mon May 04, 2015 4:35 am
by dunbarx
Hi.
Such a command should only close the topmost stack (or substack, if on top). It always has for me, though I always use a Mac. But there would have been lots of noise if this was not true for Windows, and that noise would have started long ago.
Does it so the same thing with a new stack and some substacks? Perhaps place a button with your handler in one of those substacks and test?
Craig Newman
Re: 'Close this stack' closes all stacks
Posted: Mon May 04, 2015 11:09 pm
by croivo
Just found what caused the problem...
I had this code on main stack:
Without that code it works...
Is there any other way to kill the app when X button is closed (so it doesn't appear in task manager under processes?)
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 3:24 am
by dunbarx
Well, that makes perfect sense. You send a "closeStack" message that quits LC. That is a guaranteed recipe to close all open stacks.
But what did you mean by:
Is there any other way to kill the app when X button is closed (so it doesn't appear in task manager under processes?)
Craig
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 10:29 am
by croivo
When I close my compiled program with X button on Windows, it still keeps running in background (I can see that process in task manager).
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 1:34 pm
by FourthWorld
Does your stack use any timers?
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 10:27 pm
by croivo
Yes... but they are not active. Even if they are, how to force killing the app?
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 11:26 pm
by dunbarx
I do not really know, or care to know, how Windows works. What I think Richard alluded to was that there might be pending messages in a running timer, perhaps with a "send in time..." command that (might) prevent the stack from closing. Is this a possibility?
Craig Newman
Re: 'Close this stack' closes all stacks
Posted: Tue May 05, 2015 11:50 pm
by FourthWorld
Code: Select all
on KillAllPendingMessages
repeat until the pendingMessages is empty
cancel item 1 of the pendingMessages
end repeat
end KillAllPendingMessages
Re: 'Close this stack' closes all stacks
Posted: Wed May 06, 2015 3:15 pm
by dunbarx
Richard.
Does you handler offering imply that such processes still linger in winafter LC quits? This does not seem to be the case on a Mac.
Craig
Re: 'Close this stack' closes all stacks
Posted: Wed May 06, 2015 5:16 pm
by jacque
Several things can prevent the engine from completely shutting down. The most common are any pending messages still in the queue, which Richard's handler fixes. Another is any open drivers that haven't been closed. If you are using speech, databases, or any other features that use drivers be sure to shut those down before quitting.
You may also need to close any substacks that are hidden but still open.
Re: 'Close this stack' closes all stacks
Posted: Wed May 06, 2015 7:56 pm
by dunbarx
Jacque wrote:
Code: Select all
You may also need to close any substacks that are hidden but still open.
Is this true? Is it on all platforms?
Craig
Re: 'Close this stack' closes all stacks
Posted: Wed May 06, 2015 8:29 pm
by FourthWorld
Yes, the LiveCode process will close when all of the following are true:
- no more pending messages
- no open drivers or other child processes
- the last stack window is closed