Re: NSOutlineView, NSTreeController and Sample Code "Source View"
Re: NSOutlineView, NSTreeController and Sample Code "Source View"
- Subject: Re: NSOutlineView, NSTreeController and Sample Code "Source View"
- From: Jonathan Dann <email@hidden>
- Date: Sun, 17 Feb 2008 17:38:21 +0000
On 17 Feb 2008, at 15:25, Ralph Manns wrote:
How can I add a ChildNode to a Node that is not selected in the
OutlineView.
You have to use NSTreeController's -setSelectionIndexPath: and give it
the index path of the object you want to add the child node to.
Follwing this you can then add a node as you normally would.
Getting the index path of the node you want is the tricky part as
NSTreeController still has no -indexPathForObject: that you can send
it one of your Node objects and it will find it in the tree. I
recommend having a look at Wil Shipley's blog post on the subject
where he writes such a method as a category on NSTreeController.
http://www.wilshipley.com/blog/2006/04/pimp-my-code-part-10-whining-about.html
Alternatively you have to use -insertObject:atArrangedObjectIndexPath:
I've used this example code a lot, so feel free to ask away.
Jon
_______________________________________________
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