Re: display NSXMLDocument with NSOutlineView and NSTreeController
Re: display NSXMLDocument with NSOutlineView and NSTreeController
- Subject: Re: display NSXMLDocument with NSOutlineView and NSTreeController
- From: Torsten Curdt <email@hidden>
- Date: Wed, 18 Apr 2007 00:04:33 +0200
On 16.04.2007, at 22:42, Chris Hanson wrote:
On Apr 16, 2007, at 10:55 AM, Torsten Curdt wrote:
Unfortunately that example does not show this for a NSOutlineView
(and I don't see how to make it use one ;-) ).
On a button click I open a panel, select a file, parse that file
into a NSXMLDocument and would like to feed that into a
NSOutlineView.
Now sure what I am after?
The central issue is that you see this as a case of "feeding" data
"into" an NSOutlineView. What you actually do is provide data to
an NSOutlineView. You can do this in one of two ways:
(1) Create a data source for the outline view that follows the
NSOutlineViewDataSource informal protocol, and provides information
from your XML document.
Not sure how that works exactly yet but...
(2) Use an NSTreeController that is appropriately bound to your
model objects to provide data to the outline view; populate your
model objects with information from your XML document.
...with the link to the docs that I've posted and a little more
trying it finally got it working.
The only thing that is a bit weird is that (although the bindings are
set) I still have to have to set the model on the tee controller
manually.
[treecontroller setContent:nil];
[treecontroller setContent:[dom rootElement]];
The tree controller is bound to my class with the exact same key path
(dom.rootElement). Could it be the problem that I change the dom
reference at runtime? ...so the tree controller is bound to the old
instance?
cheers
--
Torsten
_______________________________________________
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