Re: Menu Item Shortcuts Without Menu Items?
Re: Menu Item Shortcuts Without Menu Items?
- Subject: Re: Menu Item Shortcuts Without Menu Items?
- From: "Frank D. Engel, Jr." <email@hidden>
- Date: Fri, 17 Mar 2017 20:29:21 -0400
Thanks to those who answered; the "alternate" property is doing what I
need it to.
The delegate method sounds good too, but I wasn't able to get that to
work for some reason - I may go back and look at that more closely in
the future but for now I think I'm content with the possible limitation
described.
On 3/16/2017 16:12, Kyle Sluder wrote:
On Mon, Mar 13, 2017, at 04:50 PM, Ken Thomases wrote:
On Mar 13, 2017, at 5:12 PM, Frank D. Engel, Jr. <email@hidden>
wrote:
I need to create the equivalent of a menu item shortcut, but without the menu item... or, to assign two different shortcuts to the same menu item.
More precisely: I have a menu item with a shortcut of Command+L.
I need Command+Shift+L to do exactly the same thing, but it doesn't look right having two copies of the menu item just to support a second shortcut.
Mark the second menu item as an alternate. That is, set its "alternate"
property to true. It will "hide" in the same slot of the menu as the
other item and only show when the extra modifier (Shift, in this case) is
pressed.
One downside of this approach might be that the menu item appears twice
in VoiceOver. (I haven’t tried it myself.)
A more targeted approach might be to attach a delegate to the menu that
contains the aliased item, and implement
-menuHasKeyEquivalent:forEvent:target:action: to return the Command+L
menu item’s target and action if it sees Command+Shift+L.
--Kyle Sluder
Cheers,
Ken
_______________________________________________
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
_______________________________________________
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