'Close this stack' closes all stacks

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

'Close this stack' closes all stacks

Post by croivo » Sun May 03, 2015 4:55 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: 'Close this stack' closes all stacks

Post by dunbarx » Mon May 04, 2015 4:35 am

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

croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Re: 'Close this stack' closes all stacks

Post by croivo » Mon May 04, 2015 11:09 pm

Just found what caused the problem...

I had this code on main stack:

Code: Select all

on closeStack
   quit
end closeStack
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?)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: 'Close this stack' closes all stacks

Post by dunbarx » Tue May 05, 2015 3:24 am

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

croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Re: 'Close this stack' closes all stacks

Post by croivo » Tue May 05, 2015 10:29 am

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).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10066
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: 'Close this stack' closes all stacks

Post by FourthWorld » Tue May 05, 2015 1:34 pm

Does your stack use any timers?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

croivo
Posts: 111
Joined: Wed Feb 26, 2014 11:02 pm

Re: 'Close this stack' closes all stacks

Post by croivo » Tue May 05, 2015 10:27 pm

Yes... but they are not active. Even if they are, how to force killing the app?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: 'Close this stack' closes all stacks

Post by dunbarx » Tue May 05, 2015 11:26 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10066
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: 'Close this stack' closes all stacks

Post by FourthWorld » Tue May 05, 2015 11:50 pm

Code: Select all

on KillAllPendingMessages
    repeat until the pendingMessages is empty
      cancel item 1 of the pendingMessages
   end repeat
end KillAllPendingMessages
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: 'Close this stack' closes all stacks

Post by dunbarx » Wed May 06, 2015 3:15 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7403
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: 'Close this stack' closes all stacks

Post by jacque » Wed May 06, 2015 5:16 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: 'Close this stack' closes all stacks

Post by dunbarx » Wed May 06, 2015 7:56 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10066
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: 'Close this stack' closes all stacks

Post by FourthWorld » Wed May 06, 2015 8:29 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply