Question

I try to do some treatment when a NSComboBox looses first responder status, and hence gets "resignFirstResponder", however my treatment should happen only when the combobox really loose the first responder status, not when the internal NSTextView used to implement the text of the combobox itself gets the first responder status.

Is there an official way to detect that the first responder status went from the NSComboBox to its inner NSTextView? Can I get a pointer to that NSTextView? and maybe set its delegate?

Regards

Was it helpful?

Solution

In fact, there is no "inner NSTextView", there is one such NSTextView per NSWindow, which gets reparented to the editing control (text, combobox) which needs it at will, this is the so called "field editor". There is a possibility to override it by the way with windowWillReturnFieldEditor in NSWindow delegate.

The actual answer is that we can detect becomeFirstResponder on the combo and then textDidEndEditing.

Reference: "Working With the Field Editor" in "Text editing programming guide" in Apple developer documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top