在Cocoa应用程序中设置自定义标签顺序 [英] Setting a custom tab order in a Cocoa application
问题描述
我有一个带有两列字段的窗口。左侧是 NSTableView
和 NSTokenField
,而右侧是两个 NSTextField
s。我希望选项卡顺序在左边,然后在右边。 (因此顺序应为 NSTableView
, NSTokenField
, NSTextField
,在我的窗口中是 NSTextField
。)但是,可可似乎在确定自己的首选顺序,从上到下。 NSTokenField
在窗口中的位置低于任何其他控件,因此它将始终从 NSTableView
的右侧进行制表 NSTextField
s,然后回到左下方 NSTokenField
。
I have a window with two columns of fields. On the left, there is an NSTableView
and an NSTokenField
, and on the right, there are two NSTextField
s. I want the tab order to go down the left, then down the right. (So the order should be NSTableView
, NSTokenField
, NSTextField
, NSTextField
in my window.) However, Cocoa appears to be determining its own preferred order, going from the top to the bottom. The NSTokenField
is positioned lower in the window than any other control, so it will always tab from NSTableView
, to the right NSTextField
s, then back to the bottom left NSTokenField
.
我已尝试按照称为启用文本字段之间的制表符,并按照需要在Interface Builder中的字段之间拖动nextKeyView。这似乎对制表符顺序的影响绝对为零,据我所知,可可似乎仍在使用其默认检测方法来选择制表符顺序。
I have tried following this section of the Apple developer documentation called Enable Tabbing Between Text Fields and dragging nextKeyView in Interface Builder between the fields in the order that I want. This seems to have absolutely zero effect on the tab order, and from what I can tell, Cocoa appears to still use its default detecting method to choose a tab order.
任何想法?我的目标是10.6 +。
Any ideas? My target is 10.6+.
推荐答案
请确保还设置了 initialFirstResponder
窗口到第一个字段的出口(在这种情况下为表格视图)。
Make sure that you also set the initialFirstResponder
outlet of the window to the first field (the table view in this case).
这篇关于在Cocoa应用程序中设置自定义标签顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!