按NSTextField中的制表符选择所有文本,而不是转到下一个控件 [英] Pressing tab in NSTextField selects all text instead of going to next control
问题描述
我有多个视图,所有工作正常,但由于某种原因,一个视图不会关注下一个控件,当输入tab键。相反,它选择当前NSTextField的所有文本。
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?
这是一个NIB包含一个NSView。
在视图中有两个NSTextField,一个中的tab不会前进到下一个,而是选择当前的所有文本。
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.
推荐答案
我自己找到了。
对于将来有任何人有类似的问题:
I've found it myself. For anyone in the future having a similar problem:
如果要使用addSubView或replaceSubView命令在NSWindow或NSView中动态替换视图,告诉NSWindow使用NSWindow的recalculateKeyViewLoop或setAutorecalculationsKeyViewLoop重新计算ViewLoop
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
更多信息:
http://www.cocoabuilder.com/archive/cocoa/195341-nested-nsviews-and-keyboard-focus .html
这篇关于按NSTextField中的制表符选择所有文本,而不是转到下一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!