Re: Hiding an NSMenu, or making keyboard shortcuts not tied to a menu item?
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.