I need to detect whether any NSControl, such as an NSButton, can get the focus by using the Tab key.
It can, if the user has enabled the option in the System Preferences under Keyboard / Shortcuts / Keyboard / "Change the way Tab moves focus".
More specifically, I like to make a NSButton the first responder but only if the "all controls can get focus" mode is enabled. Maybe I could ask the control if it accepts the firstReponder status?
I tried calling acceptsFirstResponder on a button, but that returns YES even if it can't become firstReponder by using the Tab key, so that's not the right way.
canBecomeKeyViewis the property/method you're looking for.From Cocoa Event Handling Guide, Keyboard Interface Control