Pressing a tab in NSTextField selects all the text instead of moving to the next control

I have several views, everything works fine, but for some reason, the view does not focus the next control when entering the tab key. Instead, it selects all the text of the current NSTextField.

I forget something really stupid here; can anyone help me with this?

So this is the NIB containing the NSView. In a view of two NSTextFields, clicking a tab in one will not advance to the next, but instead select all the text in the current one.

+4
source share
1 answer

I found it myself. For those who will have a similar problem in the future:

If you are going to dynamically change views in NSWindow or NSView using addSubView or replaceSubView, you need to tell NSWindow to recalculate ViewLoop using NSWindow recalculateKeyViewLoop or setAutorecalculatesKeyViewLoop

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

+12
source

Source: https://habr.com/ru/post/919859/


All Articles