Re: 2 questions and 1 idea
Re: 2 questions and 1 idea
- Subject: Re: 2 questions and 1 idea
- From: Mike Ferris <email@hidden>
- Date: Thu, 7 Jun 2001 11:05:38 -0700
So 2 questions:
- I've been coding a Cocoa Service and it's surprisingly too easy. The
only thing that is not clear is with the Menu Shortcut associated to
the Services Menu. What happens when the short cut you have for one
service is already used by the current Cocoa Application ? Which one
wins ?
My experience, with a carbon app (which may or may not be relevant):
the outcome is non-deterministic, indicating a race condition of some
kind.
Specifically, in Eudora, there's Command-H for Hide this Application
and Command-H for Add attachment. Whenever I hit the combination, I
don't know which behavior I'm going to get. I've gotten the latter when
there was no open email to attach a file to and the former when there
was. ::shrug::
In Cocoa, there are three levels of precedence for command keys in menus:
- User key equivalent overrides via NSUserKeyEquivalents default
- Application menu items
- Services menu items
For collisions, items in the category higher in the above list win.
Collisions between items within these categories are handled on a
first-come-first-served basis. This applies to which item is actually
invoked as well as to which item visually gets the key drawn on it.
Only one item in a Cocoa app should ever have Cmd-H drawn next to it,
for example, regardless of how many items want it.
Mike Ferris