On Mon, Mar 13, 2017, at 04:50 PM, Ken Thomases wrote: > On Mar 13, 2017, at 5:12 PM, Frank D. Engel, Jr. <fde...@fjrhome.net> > 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com