How does one build a simple nib file to control a window?
How does one build a simple nib file to control a window?
- Subject: How does one build a simple nib file to control a window?
- From: "James Stein" <email@hidden>
- Date: Fri, 12 Oct 2007 17:14:57 -0700
I am stumped by what ought to be a very simple task:
I tried to build a Window nib file; the window to be controlled
by an NSWindowController subclass called myController.
Ought to be a snap. But the window wouldn't display correctly
so I overrode this method in the controller:
- (void) windowDidLoad { // for debugging
NSLog(@"myController: loaded window.");
NSWindow *w = [self window];
if (w==nil) NSLog(@"myController: but self window is nil !");
}
And although the nib file loaded, the window did not! It was nil!
So I went looking for examples to copy and found "SKTInspectorController"
in Developer/Examples/AppKit/Sketch. I reduced code and nib files
drastically, so that mine and theirs were "nearly" the same, and ran
both in a little driver program. Theirs works, mine doesn't.
Looking at the 'Classes" views, both of us have sub classed
NSWindowController, and named the subclass.
After more sleuthing, I find a difference I cannot eliminate,
nor can I build a file like theirs:
The 'Sketch' nib file has three objects in the Instances(icon) view:
"File's Owner", "First Responder", and "Panel".
My nib file has those, and a fourth: "myController".
But, looking at the Instances(outline) view, I see that they have
managed to get 'NSObject' renamed as their subclass; whereas
in my nib file, 'NSObject' still appears, and my subclass is the
4th (extra?) object.
This extra(?) object appears when I "instantiate" my subclass.
My connections between the controller subclass and the window
are the same as in Sketch.
Try as I may, I can't find a sequence of actions in the Interface Builder
to create a nib file with only three top-level objects, with an
NSWindowController as the file owner. I've read the Interface Builder
manual and help, and searched the 'net.
What do I fail to understand?
_______________________________________________
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