• 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
Binding InfoPanel to currentDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding InfoPanel to currentDocument


  • Subject: Binding InfoPanel to currentDocument
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 25 Oct 2012 18:36:42 +0700

I have a Panel which has a PopUpButton which has it's Content Values bound to an ArrayController.
The ArrayController has it's Content Array bound to File's Owner: currentDocument.listOfThings.

The File's Owner (aka) Application Delegate:
@property (readonly) DocumentSubclass *currentDocument;

- (DocumentSubclass *)currentDocument
{
	return [  [ NSDocumentController sharedDocumentController ] currentDocument ];
}

and the DocumentSubclass has of course:
@property (readonly) NSArray *listOfThings;

The problem: how does the ArrayController know that the currentDocument has changed?

Currently I am using a rather silly hack:
My DocumentSubclass calls in init and windowWillClose:
	AppDelegate *a = [ [ NSApplication sharedApplication ] delegate ];
	[ a somethingIsChanging ];

and the Application Delegate has:

- (void) somethingIsChanging
{
	[ self willChangeValueForKey: @"currentDocument" ];
	[ self performSelector: @selector(didChangeValueForKey:) withObject: @"currentDocument" afterDelay: 0 ];
}

This works, but I have a strong feeling that there is a very obvious better solution which I somehow cannot see.

Gerriet.

_______________________________________________

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: Binding InfoPanel to currentDocument
      • From: Seth Willits <email@hidden>
  • Prev by Date: Re: Security-scoped bookmarks linked to code signing?
  • Next by Date: Why does a custom CALayer property work differently from a standard one?
  • Previous by thread: Re: [Q] a view is associated with more than one view controller?
  • Next by thread: Re: Binding InfoPanel to currentDocument
  • Index(es):
    • Date
    • Thread