Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTextField's selector triggered on lost focus?

I'm using an NSTextField as a search field, and it is bound to a selector. It is triggered when the return key is pressed (as expected), but it is also triggered when the field loses focus.

I don't want the selector to be triggered on lost focus. Is it possible to get around this behavior?

like image 424
Kristina Brooks Avatar asked Jul 17 '11 20:07

Kristina Brooks


2 Answers

In Interface Builder or the XIB editor of Xcode 4, change the text field's Action property to Send on Enter Only.

NSTextField action

like image 74
spudwaffle Avatar answered Nov 07 '22 15:11

spudwaffle


See -sendsActionOnEndEditing in the NSCell documentation.

like image 32
NSResponder Avatar answered Nov 07 '22 13:11

NSResponder