Re: How to set tab order in a window that has view swapping
Re: How to set tab order in a window that has view swapping
- Subject: Re: How to set tab order in a window that has view swapping
- From: Marc Respass <email@hidden>
- Date: Tue, 25 Jan 2011 15:40:25 -0500
Hi Abhijeet,
> Hi,I have a single window with a toolbar and a custom view in my application. Toolbar has Back and Next button on it. This is my MainMenu.xib. I have 5 more xibs other than the MainMenu.xib in my application. Each xib contains one view with different controls in it. On Next and Back button click on my Main window the current view is swapped with another view. On my first view there is a NSPopupButton. I want when the first view is displayed the keyboard focus should be on NSPopupButton and on tab key press it should move to next control in the tab order. Basically I want my user to be able to use the tab control to change the keyboard focus in all my views.
In IB, set your window to "auto recalculates view loop". To be positive, you can also set that on the window when you load your new view. The technique that I use for making a particular control first responder is to put a common tag on it (say 2112) which you use to get the control without requiring an outlet. Then in awake from nib you can do
NSControl *control = [[self view] viewWithTag:2112];
[[[self view] window] makeFirstResponder:control];
if all of your views have a common superclass, you can put that code in the superclass.
Hope this helps
Marc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden