• 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
Re: Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item?


  • Subject: Re: Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item?
  • From: Dustin Voss <email@hidden>
  • Date: Fri, 18 Jul 2003 11:11:02 -0700

On Wednesday, July 16, 2003, at 06:51 PM, Nick Zitzmann wrote:

I RTFM'd and checked the archives, and didn't find anything, so...

In one application I'm trying to make an NSMenu that is hidden from the user, so it doesn't get drawn on the screen, but it does respond to keyboard commands like Command-whatever.

How do I do this? I can't find any way in the reference or in IB to make an NSMenu hidden. I already tried placing a pull-down menu inside a window and hiding it behind a custom view, but it would only show up anyway as a half-transparent menu. I think iTunes does something like this; can this only be done in Carbon?

Yes, this can be done from Carbon. There is a menu attribute called kMenuAttrHidden which is designed for this exact purpose. You can get a Carbon menu from an NSMenu with the undocumented function "MenuRef _NSGetCarbonMenu(NSMenu *)".

If it's not possible to hide an NSMenu, is it possible to make it so that an action is triggered by a keystroke that is _not_ (a) assigned to a menu item, (b) assigned to a toolbar item (which I understand doesn't work anyway), (c) detected in an NSView's -performKeyEquivalent: method, or (d) dependent on private APIs?

You can probably intercept it in a "sendEvent:" method. See "file:///Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/BasicEventHandling/Concepts/KeyEquiv.html".
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item? (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: NSAppleScript - "Tell Finder to Eject Disk 'Foo' " - strange Log messages
  • Next by Date: Re: Problem receiving key events in CLI created window
  • Previous by thread: Re: Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item?
  • Next by thread: Searching for Specific Files/Problem with hiding on login
  • Index(es):
    • Date
    • Thread