• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best practice for hidden keyboard shortcuts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best practice for hidden keyboard shortcuts


  • Subject: Best practice for hidden keyboard shortcuts
  • From: Philip Dow <email@hidden>
  • Date: Fri, 2 Nov 2007 08:20:38 -0700

I'm looking to provide hidden keyboard shortcuts in my cocoa app. Actually this was already working in Tiger but the technique I was employing seems to no longer work in Leopard.

In Tiger I was using a hidden popup button. Worked great, but no more. I've search the lists for possible solutions but have not come across a concrete answer. Recommendations include using Carbon's kMenuAttrHidden, Leopard's new hidden menu attribute, performKeyEquivalent: and overriding NSApp's sendEvent:

I don't mind delving into Carbon, but to get a MenuRef for a NSMenu I am required to use an undocumented method. I'd like to avoid that if i can. Leopard's new hidden menu attribute looks promising, but hiding a menu removes the key equivalents for its menu items, defeating my purpose. performKeyEquivalent would be great, but documentation says you are limited to key equivalents that have no modifiers or the shift modifier only. I'd like to use control and option as well.

This leaves me with overriding NSApp's sendEvent: . My current thinking is to check in that method for key events with the cmd modifier and ask the main window or window's delegate if it would like to handle a key equivalent. This is similar to the performKeyEquivalent: route except I can now use additional modifiers. If the window or delegate doesn't care to handle the event, I simply call super's sendEvent:

Before I go through with this implementation I was just wondering if all of that sounds right or if there is a better way to do it.

-Phil
_______________________________________________

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


  • Follow-Ups:
    • Re: Best practice for hidden keyboard shortcuts
      • From: David Spooner <email@hidden>
  • Prev by Date: Re: HELP with Usb Communication
  • Next by Date: Transparent divider
  • Previous by thread: re: Enumerating over managed object to-many relationships
  • Next by thread: Re: Best practice for hidden keyboard shortcuts
  • Index(es):
    • Date
    • Thread