Overriding system shortcuts in OSX

Howard Bornstein bornstein at designeq.com
Mon Nov 9 15:28:44 EST 2015

I saw this when I tried to assign Cmd-H to a menu item. It simply did not
show up in the menu because Apple uses Cmd-H to hide the current

Even assuming that Apple traps the Quit command and handles it, when I
assigned Cmd-Q with a multi-stack stand alone, it didn't work. I had to use
the solution proposed by Martin Koob:

Each of the substacks' scripts have a shutdownRequest handler but not a
'pass shutdownRequest' command.  This handler sends a prepareToQuit command
to the main card of the main stack.

substack stack script
on shutdownRequest
   send "preparetoquit" to card "main" of stack "mainstack"
end shutdownRequest
The main card of the main stack has the prepareToQuit handler which just has
a quit command.  This triggers the shutdownRequest handler in the main card.
This shutdownRequest handler has all of the code you want implemented before
quitting.  This handler has the 'pass shutdownRequest' command that allows
the application to quit.

Mainstack >card "main" script
on preparetoquit
end preparetoquit

on shutdownRequest
    <do stuff here>

    pass shutdownRequest
end shutdownRequest

On Mon, Nov 9, 2015 at 9:20 AM, Bob Sneidar <bobsneidar at iotecdigital.com>

> Oddly, when I have a Quit command in a custom menu, the option does not
> show up. I think this is because the Livecode menu has a Quit option
> already, which when using the browse tool will hilite when pressing CMD-Q,
> but will not actually quit. I have not tested this in a standalone yet.
> I have no shutDownRequest commands in my scripts.
> Bob S
> On Nov 7, 2015, at 10:54 , J. Landman Gay <jacque at hyperactivesw.com
> <mailto:jacque at hyperactivesw.com>> wrote:
> OS X traps and responds to its own system-wide shortcuts and does not pass
> them on to the app, so LC won't know about those.
> But Cmd-Q behaves slightly differently. OS X does notify the app so it can
> put up save dialogs or do other housekeeping. If Cmd-Q isn't working, then
> there is probably something in your app that prevents it from quitting,
> like pending messages, open drivers, not passing "shutdownRequest", etc.
> On 11/6/2015 4:20 PM, Bob Sneidar wrote:
> It's my understanding that with OS X you cannot do this. I would like to
> make a quit hotkey so users can quit my application, but I cannot seem to
> get that to work.
> Bob S
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


Howard Bornstein

More information about the use-livecode mailing list