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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to