Search field in menu, like Help menu has

  • My OS X app programmatically creates a menu which is displayed in its

    (1) Dock Menu
    (2) Status Item
    (3) a menu which use can pop up anywhere via a global keyboard shortcut, which invokes -[NSMenu popUpMenuPositioningItem:atLocation:inView:]

    I would like to add a search field at the top of this menu, like the search field in the Help menu of any Cocoa app.  At least in instance (3).

    In Apple's document "Application Menu and Pop-up List Programming Topics" [1], it is stated that "A view in a menu item can receive all mouse events as normal, but keyboard events are not supported."  But a search field certainly supports keyboard events!

    So how might Apple be doing that?


    Jerry Krinock
  • On Jun 9, 2013, at 10:14 PM, Jerry Krinock <jerry...> wrote:

    > So how might Apple be doing that?

    The same way they do the Spotlight “menu”: a borderless window that looks like a menu.

    Sadly, I don't know if there's a way to hook into the menu manager to get the same results in your app. But you _may_ be able to use a custom view menu item that overrides -viewDidMoveToWindow: to set up a border less window of its own.

    --Kyle Sluder
previous month june 2013 next month
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today