Reputation: 65
Is there any way to detect and respond when a control on a window loses focus?
I want to run some code when a user leaves NSTableView.
Thanks,
Upvotes: 4
Views: 1066
Reputation: 64002
You can do this in 10.6 and later by using KVO to observe the window's firstResponder
. It will change when the focused control in the window changes.
Put the code you want to run in the observing object's observeValueForKeyPath:ofObject:change:context:
method.
Upvotes: 3