'Quit' mystery
Graham Samuel
livfoss at mac.com
Tue Nov 26 08:21:06 EST 2013
I have a desktop app (Mac and Windows) which has one main menu: in that menu is a conventional 'File' submenu, ending with 'Quit' (Mac) or 'Exit' (PC). I need to do some housekeeping before the actual quit, so in my menu handler for file I have code like this:
case "Quit"
case "Exit"
<do stuff>
quit
break
When I create a standalone, all the other items in the 'File' menu, such as 'Save', work as expected, but the 'Quit' just quits, and my "stuff" doesn't get done. This is true both on the Mac (where the 'Quit' menu item gets moved to another menu) and the PC (where it doesn't). I even put a statement at the beginning of the 'File' menu that makes a log entry showing that the menu has been called: again, it works for 'Save' and such, but not for 'Quit' .This log would work even if my spelling of 'Quit' were wrong, for example, so the 'Quit' is being hijacked by the engine somehow and bypassing my menu handler completely.
Thinking I had misunderstood something, I then put in a 'shutdownRequest' handler in the main library stack of my app. I understand from the LC Dictionary that this is fired by the 'quit' command, so now I have
on shutdownRequest
<do stuff>
end shutDownRequest
According to the Dictionary, if I don't pass the shutdownRequest, then the app won't quit. I thought this would be good for debugging purposes. Anyway, this handler is never called, and the standalone just quits as before, so the 'quit' to which my app responds must be somehow in another path. As usual, doubtless I've made an error, but what kind of mistake can it be?
TIA for any assistance
Graham
More information about the use-livecode
mailing list