I have subclassed 3 macOS controls: NSCheckbox, NSTextField and NSButton (this one to have a checkbox) and I have override the methods resignFirstResponder and becomeFirstResponder as following:
override open func resignFirstResponder() -> Bool {
Swift.print("\(identifier!.rawValue) resignFirstResponder")
return super.resignFirstResponder()
}
override open func becomeFirstResponder() -> Bool {
Swift.print("\(identifier!.rawValue) becomeFirstResponder")
return super.becomeFirstResponder()
}
I thought that when I focus a control (with keyboard Tab or with a mouse click) I would have resignFirstResponder called for the control having the focus and becomeFirstResponder called for the control taking the focus.
But it is not exactly like that. I get as result:
identCheck becomeFirstResponder
identCheck resignFirstResponder
identText1 becomeFirstResponder
identText1 resignFirstResponder
I don't understand why the method resignFirstResponder is called for identText1, after it becomed firstResponder.