• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDocument and makeWindowControllers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDocument and makeWindowControllers


  • Subject: NSDocument and makeWindowControllers
  • From: email@hidden
  • Date: Sun, 10 Dec 2006 13:02:47 -0500


I am trying to get a seperate Nib file which contains a window to display. I chose, maybe not correctly to use the well documented approach of subclassing NSDocument and WindowController.


The nib I built ( and this is all in Project Builder 10.2 ) will load appears to work only if I directly make the call to force the makeWindowControllers fire on the init of the NSDocument subclass. It looks like this

- (id)init
{
	self = [super init];
	if (self) {
	[self makeWindowControllers];
	}
	return self;
}

From what I have seen in code examples, nobody has to do this. When I look at all the attached nibs, there outlet, file owners, and actions, everything is completely fine. the one caveat is that the Cocoa application is not a Document Based app.

If I remove the [self makeWindowControllers], the window will not load but when I add it it appears to work fine.
The NSWindowController which works with the NSDocument is a subclass and I told the file owner is Interface Builder that the controller was the owner.


Anyone know why I have to manually tell the Document to "makeWindowControllers" in the subclass of the NSDocument? I did comment out the - (NSString *)windowNibName method as it appears to say you should if you implement the makeWindowController method. <<Who is supposed to call that? me or is this built into NSDocument, NSDocumentController, and NSWindowController when the nib fires up.

Since we are on the topic, all I ever wanted to do was have a separate nib containing a window and some controls appear and respond to some buttons. Is there an easier way to make a window appear other than the main window for the app that you can call and show without having to implement a whole NSDocument?

So what I have done is made a regular Cocoa app and added an NSDocument to it to produce a second window. I did this and wanted to segregate the two controllers because the second window is very complex in what happens......twain drivers loading images and stuff. trying to maintain a mvc pattern.

And by the way, I have read and tested the following documentation and there is no answers "Cocoa Programming" "Cocoa Recipes" "Cocoa Applications" and "Mac OS X Programming" All have good examples but when using their examples, my app uses their approach except I start out with a non document based at requiring me to call makeWindowControllers still needs to be called......but in all their apps it does not.....


Jim

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: NSDocument and makeWindowControllers
      • From: "Scotty's Lists" <email@hidden>
  • Prev by Date: Re: Init with something....
  • Next by Date: Returning an NSDictionary/record to AppleScript command
  • Previous by thread: Re: Application runs multiple times
  • Next by thread: Re: NSDocument and makeWindowControllers
  • Index(es):
    • Date
    • Thread