Re: NSDocument Question
Re: NSDocument Question
- Subject: Re: NSDocument Question
- From: Quincey Morris <email@hidden>
- Date: Mon, 7 Feb 2011 12:22:08 -0800
On Feb 7, 2011, at 11:54, Bruce Cresanta wrote:
> Ii have two subclasses of NSDocument. One of the subclasses only ever needs one instance window. How do I query NSWindowController for the open window, and if that fails, create it. Sorry for the confusion.
Well, sorry but I'm still confused. You have two subclasses, but subclasses aren't objects. Are you saying you're creating one object of *each* NSDocument subclass when a *single* file is opened?
Or are you asking about the number of windows per NSDocument (in which case the existence of two subclasses seems irrelevant). The document controls how many windows get created (either via 'windowNibName' or 'makeWindowControllers' initially), so any given subclass can enforce its own single-window rule.
Or are you asking whether multiple document objects of one of the subclasses can share a single window? That seems like it would mess up the standard document semantics (and menu items).
If you need to know whether a file already has a document open, you can use '[[NSDocumentController sharedDocumentController] documentForURL:...]' to find it, and if you need to know what windows a document has, you can use [document windowControllers] to find their window controllers.
But I'm just throwing out random ideas at this point -- I still don't understand what you're trying to achieve.
_______________________________________________
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