This caught me out today, so I thought I’d share to save someone else scratching their head. The problem I was having was thus. In interface builder I had a window with an NSTextField and an NSButton. I want to be able to tab between them. I did what I thought was correct:
- Set the intialFirstResponser for the NSWindow to be my NSTextField
- Set the NSTextField nextKeyView to be the NSButton
- Set the NSButton nextKeyView to be my NSTextField
But this was not working in the app! It Turns out that in the Apple > System Preferences > Keyboard there is a setting that allows you to press Tab to move keyboard focus between:
- Text boxes and lists only
- All controls
I think the top one is set by default. Once changed to All controls everything worked as expected.