problems with tab key and custom views


James Walker
 

I have a window with 3 views that I want to be able to switch focus between using the tab or shift-tab keys.  Going by the view programming guide, it seems like I shouldn't have to do anything besides set up the nextKeyView loop in the nib and have my views return YES from acceptsFirstResponder, but that's not working.

If I override keyDown: and call interpretKeyEvents:, that doesn't switch to the next view.  So it seems like I must explicitly test for tab and shift-tab events and handle them somehow.


Calling selectNextKeyView: does nothing.  Calling nextValidKeyView returns nil.  Yet, if I call nextKeyView, it returns a non-nil view that is visible and accepts first responder status, so it seems like nextValidKeyView is not working as documented.  If I find the next key view the hard way and make it first responder, it does become first responder, but it seems like it shouldn't be so hard.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.