cocoa - How to implement key equivalent for NSSearchField -


i have cocoa application building contains nssearchfield control. want enable keyboard shortcut / key equivalent when uses presses command-option-f, search field gets focus.

however, after searching, not clear me best way implement is. there not option set nssearchfield in interface builder.

is solution subclass nssearchfield , listen keydown event (and see if key equivalent pressed?)

you can add menu item key equivalent of f i.e. commandoptionf. in menu's action, manually make search field first responder using

[window makefirstresponder:searchfield];  

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -