Re: Need help programatically wiring up an NSTreeController to an NSOutlineView
Re: Need help programatically wiring up an NSTreeController to an NSOutlineView
- Subject: Re: Need help programatically wiring up an NSTreeController to an NSOutlineView
- From: Ken Tozier <email@hidden>
- Date: Thu, 30 Oct 2008 22:16:21 -0400
On Oct 30, 2008, at 7:22 PM, Ron Lue-Sang wrote:
Reverse the order here. Add the column to the outlineView and then
bind it (the column). The binding for the column should be
[nameColumn bind: @"value" toObject: tableController withKeyPath:
@"arrangedObjects.name" options: nil];
And you don't have to bind the outlineView's content at all. That
happens automatically when you bind one of the outlineView's
columns. By binding the column after it's added to the outlineView,
you'll also get the sortDescriptors and selectionIndexPaths bindings
set up for you.
Thanks Ron. That was the ticket.
Next problem seems to be that the outline is seeing all objects as
leaf nodes. My "PMProject" class has the following "isLeafNode" and
"children" methods which is getting called and returning correct values.
Why is the outline seeing everything as a leaf node?
- (NSArray *) children
{
NSLog(@"Entered: PMProject:children");
return pages;
}
- (BOOL) isLeafNode
{
NSLog(@"Entered: PMProject:isLeafNode: %@", ([pages count] == 1) ?
@"YES" : @"NO");
return ([pages count] == 1) ? YES : NO ;
}
Projects can contain one or more "PMPage" objects which also have the
required "children " and "isLeafNode" methods
- (NSArray *) children
{
return nil;
}
- (BOOL) isLeafNode
{
return YES ;
}
Even though I'm storing PMProjects and PMPages in standard Cocoa
NSMutableArrays, do I need to add some sort of "willChangeValueForKey"
somewhere in my add/remove projects/pages code?
_______________________________________________
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