Binding InfoPanel to currentDocument
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