How can i forbid tab switching the focus into a NSView control
I have a sidebar NSOutlineView in my main window. I want the user to be able to switch the focus with the tab key through all views in the main window, but he should not be able to give the NSO开发者_JAVA技巧utlineView the focus with a tab key.
I know that with
- (BOOL)canBecomeKeyView { return NO; }
- (BOOL)acceptsFirstResponder { return NO; }
i can disable the focus for the view but i this completely disables the view. I want the user to be able to use the keys in the source list (by clicking into the list). Just put the source list out of the tab order.
There is also a hot key to give the source list the focus programmatically, which doesn't work either if i set use the functions above.
What is the correct way to do it?
Figure out which view has this view as its nextKeyView
, and set its nextKeyView
to something else. Then do the same for previousKeyView
so that the user cannot *shift-*tab into it.
精彩评论