IBOutlet to same control in different nibs
IBOutlet to same control in different nibs
- Subject: IBOutlet to same control in different nibs
- From: Trygve Inda <email@hidden>
- Date: Thu, 17 Jul 2008 16:42:46 +0000
- Thread-topic: IBOutlet to same control in different nibs
I touched on this before, but I think this is a better explanation of the
problem.
I am creating a System Pref Pane that has one window for each physical
monitor, very similar to the Displays prefpane. Like the Displays prefpane,
on the Main monitor there will be the System Pref window with 4 tabs (A B C
D), but on other monitors, the window will only have tab A.
I'd like one controller class to handle the controls in tab A regardless if
it is in a main or aux window. I'll have one instance of this class for each
screen, one of which will be handling the "main" screen.
So I have 2 nibs: my main prefpane nib that is loaded by the System
Preferecnce app (and has tabs A B C D), and an "AuxScreen" nib with tab A
which I am loading manually.
Currently I have one appController class that handles all the action in the
main window and a "auxScreen" class to handle the auxScreens. Obviously
there is a lot of code duplication in these two classes.
The main nib has a File Owner of my prefpane controller and the auxScreen
nib is owned by the auxScreen class.
This AuxScreen class begins with:
- (id)initWithObject:(id)anObject
{
self = [super initWithWindowNibName:@"AuxScreen"];
bridge = [anObject retain];
return self;
}
How can I build one class to handle both???
In that class there will be something like: IBOutlet NSSlider mySlider;
but this has to "point" to a functionally identical control in two different
windows, in two different nibs.
I am thinking that I need to instantiate one instance of this class in my
main nib... And make its IBOutlets point to the controls in mainNib. It will
start life with an init method, whereas the instances for aux windows will
be created with initWithObject so there can be some minor differences...
i.e. the class can know if it is controlling the main or an aux window.
For the aux windows the Files Owner of the auxNib will be this class.
Can a single class have an IBOutlet that goes two different (though
functionally identical) places?
Will this work? Is this even possible?
Thanks,
Trygve
_______________________________________________
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