• 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: Capturing key events in a menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capturing key events in a menu


  • Subject: Re: Capturing key events in a menu
  • From: Adam Warski <email@hidden>
  • Date: Tue, 19 May 2009 17:17:01 +0200

Hello,

On May 19, 2009, at 4:28 PM, Benjamin Stiglitz wrote:

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.)

Yes, something like that :) Only that they use a custom view I guess - maybe I should do that too, though it's more work, menus give you quite a lot for free.


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.

Well, filtering content should be easy, using [menuItem setHidden:YES/ NO]. If only I could get the keys that were pressed.
But I like the idea of embedding a search field, thanks! :)


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.

Heh :) Yeah, it seems quite hard to do something non-standard with menus.


--
Thanks again,
Adam_______________________________________________

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


References: 
 >Capturing key events in a menu (From: Adam Warski <email@hidden>)
 >Re: Capturing key events in a menu (From: Benjamin Stiglitz <email@hidden>)
 >Re: Capturing key events in a menu (From: Adam Warski <email@hidden>)
 >Re: Capturing key events in a menu (From: Benjamin Stiglitz <email@hidden>)

  • Prev by Date: Re: [ANN] KNAppGuide - an open source in-app tutorial framework
  • Next by Date: Re: [ANN] KNAppGuide - an open source in-app tutorial framework
  • Previous by thread: Re: Capturing key events in a menu
  • Next by thread: Programatically set file URL of Core Data Document?
  • Index(es):
    • Date
    • Thread