'Quit' mystery

Graham Samuel livfoss at mac.com
Tue Nov 26 11:45:32 EST 2013


Thanks, Martin - that's helpful. I don't recall leaving 'Quit' out of the 'File' menu in previous cross-platform apps I've written. In fact, the current LC User Guide says:

> The File menu and the "Quit" menu item
> 
> On OS X systems, the "Quit" menu item is normally placed in the Application menu (which is maintained by the operating system) rather than in the File menu, as is standard on other platforms. To accommodate this user-interface standard, LiveCode removes the last two menu items of the File menu when a standalone application is running on an OS X system. Therefore, the last menu item in your File menu button should be "Quit". The menu item above it should be a divider line (a dash). 
> 
When the Guide says "remove", it doesn't explain that this really **means** "remove" and not "move": the difference being that any script you put in the menu handler for the quit item will be lost - I can show this to be true. This certainly needs clarification in the forthcoming rewrite of the User Guide. BTW what happens in your apps on the PC, where the Quit menu item is not moved by the engine?

During this investigation I found out one other thing about this issue:

In the LC Dictionary, it says in the entry on 'shutdownRequest'

> In standalones, some care is needed to ensure you receive the shutdownRequest message if your application uses multiple stacks. The most reliable approach is to install a library stack or backscript to handle the message when your application starts up.

Well, my menu is in one stack (say A), and my shutdownRequest is in another (say B): these are separate mainstacks. However, in a preOpenStack handler in A, I make sure that I put the script of B into back. This clearly works for my own scripted handlers, as the script of B is a library containing handlers used successfully throughout the app and frequently called from A. However, in the situation described below, shutDownRequest is not invoked. I now find that if I move the shutdownRequest handler to A, where the menu is, it **does** get invoked on quit. So this is a bug, but maybe only (!) in the Dictionary. I am not looking forward to abstracting this for a bug report, but I guess I should do so.

Thanks again

Graham

On 26 Nov 2013, at 16:15, Martin Koob wrote:

> The way I have quit set up in my application is that in the menu handler for
> the File menu I don't have the 'quit' command in the "quit" case of the
> switch statement.   I think the engine issues the quit command on its own.
> 
> I have the 'shutdownrequest' handler in the card scripts of various cards
> and they  are triggered when I choose 'Quit' from the File menu in the
> standalone.
> 
> Martin





More information about the use-livecode mailing list