• 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: MyDocument.xib v MainMenu.xib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MyDocument.xib v MainMenu.xib


  • Subject: Re: MyDocument.xib v MainMenu.xib
  • From: Graham Cox <email@hidden>
  • Date: Wed, 30 Dec 2009 18:55:32 +1100

On 30/12/2009, at 4:23 PM, David Blanton wrote:

> In a document based app I want to have some 'inspectors" that reflect what i sgoing on in the document.  These inspectors should float.
>
> If I make NSPanel's for the inspector in MyDocument.xib then each instance of a document gets its own set of inspectors.
>
> I would like to have just one set of inspectors whose contents change as different documents are activated.
>
> Putting the inspectors in MainMenu.xib will let me make just 'one set' for all documents but I am unsure as to how to get a reference from the inspector to the document given different xib's.
>
> Suggestion please.


Each document your application opens will be a new instance built from the same nib. So even if there were a way to 'connect' objects in one nib to objects in another, it wouldn't help you - different documents will be made active at different times and your inspectors need to be aware of those activations.

A simple approach is to make your inspectors respond to all window did become main/resign main notifications, and then ask the document controller singleton for -currentDocument at those times. It can then figure out if the document itself has changed as a result of the active window change and do whatever it needs to do to inspect the document contents.

Setting up the notifications is best done in the inspector controller's -awakeFromNib method.

--Graham


_______________________________________________

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

  • Follow-Ups:
    • Re: MyDocument.xib v MainMenu.xib
      • From: David Blanton <email@hidden>
References: 
 >MyDocument.xib v MainMenu.xib (From: David Blanton <email@hidden>)

  • Prev by Date: Why does Core Data re-enter -beginUndoGrouping at Checkpoint?
  • Next by Date: Knowing mouse pressed time?
  • Previous by thread: Re: MyDocument.xib v MainMenu.xib
  • Next by thread: Re: MyDocument.xib v MainMenu.xib
  • Index(es):
    • Date
    • Thread