Re: problems with tab key and custom views
On Dec 12, 2017, at 13:22 , James Walker <list2@...> wrote:
You shouldn’t have to do anything else. I just tried it in a standard single-window document template with 3 text fields in the window, and it worked fine without any code.
I’ve never tried to use “selectNextKeyView:” but, looking at the documentation, it doesn’t seem to do the obvious thing (use the “nextKeyView” object). Instead, the documentation seems to say that it looks for the “closest” (geometrically, I assume) view in the rest of the next-view loop. This was consistent with my test. When I used “nextKey” to specify a different order for my text fields, the Tab key still jumped between them in geometry order.
Given all that, I’d have to assume that something is causing your window not to be key, or is causing something *else* in the window to be first responder — something at a different level in the view hierarchy. Do your 3 views have subview that can accept first-responder status? If you force one of them to be first responder, what does the Tab key do then?
Finally, don’t forget that windows have an “initialFirstResponder” property that you can use if its default initial choice isn’t what you want.