Re: Capturing key events in a menu
Re: Capturing key events in a menu
- Subject: Re: Capturing key events in a menu
- From: Benjamin Stiglitz <email@hidden>
- Date: Tue, 19 May 2009 10:28:16 -0400
- Mail-followup-to: email@hidden
>> When a menu is open the Menu Manager in HIToolbox handles incoming
>> events on its own. You be able to capture the events with an embedded
>> NSView, but I first need to ask the standard question: what are you
>> trying to achieve?
>
> Well, I want to know what the user typed when a menu is open, so that I
> can narrow the items displayed.
Something like the Spotlight for Help implementation, then? (That's the
search field in the Help menu in most apps in Leopard.)
> How can I embed an NSView? I know I can do that for an NSMenuItem, but
> then the menu item must have focus for the view to receive the events,
> is it not so?
The thing to do would be to embed an NSSearchField in an NSMenuItem, and
have it receive focus when the menu is opened. As for filtering the
results, you'll need to replace the menu content with your own filtered
content, which is extremely tricky to do with the current Menu Manager
API.
I’d suggest that you:
1) File a bug asking for API to simplify the implementation of this sort
of menu,
2) file a bug asking for a sample app that shows how to implement this
sort of menu,
3) think of another UI to use in the meantime.
-Ben
_______________________________________________
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