In Cocoa applications, when an editable NSTextField has focus, clicking on other Cocoa NSControl
(e.g. Sliders/Buttons) keeps focus on the NSTextField. I would like to remove firstResponder status for the field, thus closing the editable state.
One straightforward solution is to manually subclass every control so that a click will manipulate the firstResponder status, but I'm wondering if there is a clean solution without subclassing every NSControl I use. Any better solutions out there?
The solution that comes to my mind involves listening for click events. You can check to see if the click event occurs outside of your textfield and if it does resign the first responder status.
If you wanted to do something a little more complicated you could add all of the controls you want to resign the textfield's first responder status to an NSSet. Then, whenever you register a click you can check to see if the click was within the bounds of any of the elements of that set.