• 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
Re: Limiting notifications to one document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Limiting notifications to one document (From: Björn Carlström <email@hidden>)
 >Re: Limiting notifications to one document (From: Jiri Volejnik <email@hidden>)
 >Re: Limiting notifications to one document (From: Björn Carlström <email@hidden>)
 >Re: Limiting notifications to one document (From: j o a r <email@hidden>)
 >Re: Limiting notifications to one document (From: Björn Carlström <email@hidden>)

  • Prev by Date: Re: NSDocument and Multiple NSWindowControllers
  • Next by Date: Re: Boggled By Bindings
  • Previous by thread: Re: Limiting notifications to one document
  • Next by thread: Help assistant
  • Index(es):
    • Date
    • Thread