I have a requirement in a Mac OS X app for the user to be able to tab between the follow item in a single window,
- NSSearchField within the toolbar
- NSBrowser
- NSCollectionView
- NSCollectionView (second one)
- NSComboBox
when the user has tabbing between text boxes and lists only. For some reason the NSBrowser doesn't seem to count as a list, and the NSSerachField within the toolbar doesn't seem to count as a text box. But if I shift tab I can tab backwards in the NSSerachField
If I change the tab between control setting to tab between all controls the NSBrowser is tabbed to and so is the NSSearchField, though then I have a separate issue where you can not tab out of the NSSearchField. I am assuming this means that my nextKeyView chain is OK, or are the nextKeyView values just completely ignored when tab between all controls is enabled.
I have the nextKeyViews set in interface builder.
Is there some way I can get Mac OS to treat NSBrowser as a list, I are already subclassing NSBrowser. And is there a reason why a text box can not be tab into if its in a toolbar.
An addition wrinkle to this is that the NSBrowser and the First NSCollectionView are within a NSTabView and the second NSCollectionView is also in a NSTabView, the NSTabViews have NSTabeViewItems added and removed from them dynamically, so the contents sort of act like documents. I have the NSTabViews set as the nextKeyView and then I set the initialFirstResponder for the NSTabViewItems as soon as I add them to the NSTabView. I also have the nextKeyView set for the NSBrowser to tab to the NSCollectionView. And the windows initialFirstResponder is set to the first NSTabView.
ADDITIONAL INFO I have autorecalculatesKeyViewLoop to to NO. I have managed to get it to work temporarily, by in code setting up the the next responder, but then something seems to happen and Cocoa goes and changes it all.
The only solution I found was to subclass NSWindow and override the selectKeyViewPrecedingView: and selectKeyViewFollowingView:, we have this weird dynamically adding of NSTabViewItems to NSTabView and I think that was maybe break the default functionality.
This solution doesn't fix the issue with tabbing out of an NSSearchField, this maybe so users can trigger a search action, and so tabbing in a NSSearchField does not fall through to the window, I will probable end up subclassing NSSearchField.
These solutions are a bit hacker I would rather just go with Apples default functionality but that's just not an option.