NSTreeController doesn't notice insertion
NSTreeController doesn't notice insertion
- Subject: NSTreeController doesn't notice insertion
- From: David Catmull <email@hidden>
- Date: Sat, 27 Jan 2007 15:09:53 -0800
My manual bindings notification doesn't seem to be getting the
attention of my NSTreeController - new objects aren't showing up in
the corresponding outline view.
Here is the code:
-(void)
insertChild:(XVGGraphic*)child
atIndex:(unsigned int)index
{
NSIndexSet *newSet = [NSIndexSet indexSetWithIndex:index];
[self
willChange:NSKeyValueChangeInsertion
valuesAtIndexes:newSet
forKey:@"children"];
[child setParent:self];
[_children insertObject:child atIndex:index];
[self childDidChange:child];
[self objectAdded:child];
[self
didChange:NSKeyValueChangeInsertion
valuesAtIndexes:newSet
forKey:@"children"];
}
As far as I can tell this is correct. Am I missing anything? I'd
rather not have to always add objects through -[NSTreeController
insertObject:atArrangeObjectIndexPath:] because I don't think my
container class should have to know there's an NSTreeController
involved. Part of the fun of bindings is an object doesn't care
what's bound to it.
For my test case, the object executing the above method is the
NSTreeController's content object. I have an NSOutlineView bound to
the controller, and it never shows my inserted objects. This is a
drawing app, and the new objects do get drawn and respond to clicks,
so they're not getting lost entirely.
Full source file:
<http://xvg.svn.sourceforge.net/viewvc/xvg/XVG/Library/XVGContainer.m?
revision=133&view=markup>
Thanks,
--
David Catmull
email@hidden
http://www.uncommonplace.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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