Domanda

When having a NSSearchField in a toolbar, it automatically becomes first responder when pressing TAB key in the window. How can I prevent that? I.e. to get the search field to refuse first responder?

È stato utile?

Soluzione

If using Xcode 4.3.2, open up the XIB file, click the toolbar item twice to select the NSSearchField (one click selects NSToolbarItem). In the Attributes inspector, tick the "Refuses First Responder" checkbox and Bob's your uncle.

The trick here is that NSToolbarItem cannot refuse the first responder in general. However, the NSSearchField (whose ancestor is the NSToolbarItem) can refuse.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top