Re : Newbie Q: equipping an NSDocument subclass with a window controller (2)
Re : Newbie Q: equipping an NSDocument subclass with a window controller (2)
- Subject: Re : Newbie Q: equipping an NSDocument subclass with a window controller (2)
- From: email@hidden
- Date: Wed, 12 Oct 2005 19:05:23 +0200 (CEST)
- Importance: Normal
Hello Sherm,
and thank you again for your answer. You've convinced me that what I
did was (almost) entirely the wrong thing, but I see less clearly
what I should have done ...
>
> I'm not entirely sure I follow you. Is AppController a subclass of
> NSDocumentController? If not, it shouldn't be dealing with NSDocument
> subclasses.
Ah, AppController is *not* a subclass of NSDocumentController. It
is only a direct subclass of NSObject. The concept
of a "supervisor" class dealing with all controllers at the
same time looked nice to me. I was wrong ...
>
>> AppController has a method
>> showBlueWindow like this :
>>
>> -(void) showBlueWindow {
>>
>> if (!blueWindow) {
>> BlueWindow* blueWindow=[[BlueWindow alloc] init];
>> }
>> [blueWindow showWindows];
>> }
>
> Is BlueWindow a subclass of NSDocument? If so, that is *not* how you
> create a new NSDocument.
er, how is it done then ? I used to have a connection between a "Blue
Window"
button and this (void) (IBAction, actually) showBlueWindow method. What
should I
have connected that button to instead ?
>
>> and since I've implemented -makeControllerWindows for this
>> class BlueWindows (like this, following Sherm's guidelines)
>>
>> - (void) makeWindowControllers
>> {
>> NSWindowController *c = [[[NSWindowController alloc]
>> initWithWindowNibName: @"BlueWindow" owner:self] autorelease];
>> [self addWindowController: c];
>> }
>>
>> I expected the BlueWindow.nib file to be loaded automatically
>> when the
>> blueWindow object is first created.
>
> If BlueWindow is an NSDocument subclass, you're creating and managing
> it the wrong way - you should be using NSDocumentController to do that.
BlueWindow *is* an NSDocument subclass indeed. I'll take another look
at the NSDocumentController documentation ...
Ewan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden