Re: Menu Item Key Equivalent
Re: Menu Item Key Equivalent
- Subject: Re: Menu Item Key Equivalent
- From: Andy Lee <email@hidden>
- Date: Fri, 05 Aug 2011 08:25:55 -0400
On Aug 5, 2011, at 3:14 AM, Quincey Morris wrote:
> On Aug 4, 2011, at 23:42 , Kyle Sluder wrote:
>
>> Not being an Aperture user myself: Is Aperture a Cocoa app? Do these key equivalents work if the main content view isn't first responder. Are they even assigned in the menus?
>>
>> FWIW we do have unadorned keys like Z to zoom in OmniGraffle. I'm not sure how it implements that.
>
> I believe that key equivalents *without* the Command key started being supported in Cocoa applications some time before Leopard.
I don't know when they started being supported, but
(a) The Cocoa Event-Handling Guide says:
A key equivalent is a key or key combination (usually a key
modified by the Command key) that is bound typically to some
menu item or control object in the application. Pressing the
key combination simulates the action of clicking the control
or choosing the menu item.
The "usually" suggests that the Command key doesn't need to be down.
<http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW10>
(b) Empirically, I can verify in IB that they work. I assigned v to Minimize and Shift-V to Zoom and did "Simulate Interface" in IB and they worked.
Note that the "v" is displayed in the menu as an uppercase "V", and Shift-V appears with the Shift icon. I think once upon a time there was a thread about how to display an unmodified lowercase key equivalent in lowercase. If anyone remembers or knows, I'd be interested to know, just out of curiosity.
> I believe that this capability superseded a harder-to-use Carbon technique, and also provided standard menu drawing for the shift, option and control key symbols, something that had always needed custom code in Carbon.
>
> I believe we established a few weeks ago that the sequence is something like this:
I'm too lazy^Wbusy to compare point by point, and maybe it was mentioned in the earlier thread, but there's a flowchart at the link above.
--Andy
>
> -- Key combinations that *do* include the Command key are intercepted before the first responder gets a look at them.
>
> -- If they are consumed by a menu item, the first responder never sees them.
>
> -- Otherwise, or if they *don't* include the Command key, they're sent to the responder chain normally.
>
> -- If the responder chain doesn't consume them, then they're interpreted as menu item shortcuts if possible.
>
> -- If they're not consumed by a menu item, the application beeps.
>
> Those probably aren't the exact details, but this order means that typing works normally in a text field, even if the typed characters are otherwise interpretable as non-Command key equivalents.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden