How to Quit with a button

Richard Gaskin ambassador at fourthworld.com
Tue Dec 9 11:23:56 EST 2014


William Prothero wrote:
> There really is no code in the quit button. I just do:
>
> ——Method 1 ------
> on mouseUp
>    quit
> end mouseUp
>
> Or:
> ——Method 2 ------
> on mouseUp
>    send “doTheQuit” to me in 0 seconds
> end mouseUp
>
> on doTheQuit
>    quit
> end doTheQuit
>
> I tried closing all substacks. Do I need to close the mainstack first too?

The quit command should take care of closing the windows for you. 
Normally there should be no need to route a quit command through a 
timer, so to keep diagnostics simple I'd not use Method 2.

The issue here isn't likely with the quit command itself, but with 
something else going on at the moment it's called.

Are you playing any audio or video clips?  Any open Internet 
connections?  Any open files?

To see if there are any pendingMessages, try temporarily modifying your 
Quit button with this:

on mouseUp
   # quit
   answer the pendingMessages
end mouseUp

But if you were using timers you'd probably know it, so I'm disinclined 
to think it's timer-related.

If I were in your position, I'd implement logging using the 
messageMessages and a frontScript.  I occasionally need this sort of 
thing myself, so I just made a quickie version that you can add as a 
substack temporarily while you're figuring out what's going on:

<http://www.fourthworld.net/lc/4wLogger.livecode.zip>

Instructions for using it are included.  I'll be interested to know what 
you find with it.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list