views:

111

answers:

1

I have multiple views all work fine but for some reason a view does not focus the next control when typing the tab key. Instead it selects all text of the current NSTextField.

I am forgetting something really stupid here; can anyone help me on this?

So it's an NIB containing a NSView. On the view are two NSTextFields, pressing tab in one will not advance to next but instead select all text in current.

+2  A: 

I've found it myself. For anyone in the future having a similar problem:

If you are going to dynamic replace views in a NSWindow or NSView using addSubView or replaceSubView command you need to tell the NSWindow to recalculate the ViewLoop using NSWindow's recalculateKeyViewLoop or setAutorecalculatesKeyViewLoop

More info here: http://www.cocoabuilder.com/archive/cocoa/195341-nested-nsviews-and-keyboard-focus.html

Ger Teunis