Move Between ComboBox and TextField?

I’m trying to find a way to go back and forth between a comboBox and a textfield when a user pushes the return key or the tab key. Tab is easy using nextKeyView in IB. I tried adding sender’s window()'s makeFirstResponder_ in the action method of each view with the other view as the argument, and that works to move the focus to the other view when a user pushes return, but now the tab from the textField doesn’t move the focus to the comboBox (but the other way around still works). This method works if I have 2 textFields, so I’m not sure what is going on here. Is there some other method I can use to do this?

Ric

Hmmm, as far as I know, you seem to be doing it right, except maybe for the makeFirstResponder_ part… i believe you only need to use the initialFirstResponder_ method of the NSWindow to the first text field or combo box you wish to begin with, then use nextKeyView in the order you want after that. If you have an NSTabView in the way between the window and a text field, maybe you should use the initialFirstResponder_ method of that NSTabView instead. Does this help?

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

I don’t have a tabView --I’m talking about using the tab key. The nextKeyView only works for tabbing between views, it doesn’t do anything for using the return key. My object here is to have the return and tab keys behave the same, since some users might prefer one and some the other.

Ric

I understand. Two things I could suggest: make a new class and use it as a delegate to your text views and combo boxes, and then use events or NSResponder to act when the user hits return and tab… Just a thought. No idea yet on how to implement this. :slight_smile:

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)