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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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