skip down to the 1 comment

nextKeyView and moving between NSTextfield and NSButton

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:

  1. Set the intialFirstResponser for the NSWindow to be my NSTextField
  2. Set the NSTextField nextKeyView to be the NSButton
  3. 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.

Hurrah, there has been one response to this post.

  1. Madhu Kumar

    Really informative. I have been searching for the same for some hours.. :)


back to the top