Re: Limiting notifications to one document
Re: Limiting notifications to one document
- Subject: Re: Limiting notifications to one document
- From: "Louis C. Sacha" <email@hidden>
- Date: Wed, 6 Oct 2004 03:49:44 -0700
Hello...
FYI, in a normal document based app you can get the document
associated with any view by asking the window controller of the
window which contains the view. This way, any object that is a view
or knows about a view (has an outlet to a view, etc...) can "know"
what document it belongs to.
For example, if the outlet documentPageView points to a view that is
part of a window you set up in your document nib:
NSWindowController *windowController = [[documentPageView
window] windowController];
NSDocument *owningDocument = [windowController document];
Keep in mind that this only works when the view has been added to a
window and the window controller has been registered with the
document. This is more or less built in to the normal document
architecture, so for a single window document class it is pretty much
automatic (can be used in awakeFromNib or later), and for documents
that have more than one window each you just need to make sure that
all of the window controllers you create are added properly to the
document using the NSDocument addWindowController: instance method.
Hope that helps,
Louis
2. Not every object receiving the notification knows which document
it belongs to. I could set this up but it would be rather complex.
_______________________________________________
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