How to make NSComboBox lose focus after selection?
-
21-12-2019 - |
Question
I have a combo box in my OSX app and I want it to lose focus right after I change the value selection.
Right now it just stays selected and highlighted after the selection.
Any kind of help is highly appreciated!
Solution
Just figured this out myself.
Using NSComboBoxDelegate, I use this method
- (void)comboBoxWillDismiss:(NSNotification *)notification
It's getting called right before the pop-up list is going to be dismissed. Inside that method I'm calling:
[myComboBox setRefusesFirstResponder:YES];
and it does the trick.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow