[SOLUTION] Re: The Little NSOutlineView That Couldn't
[SOLUTION] Re: The Little NSOutlineView That Couldn't
- Subject: [SOLUTION] Re: The Little NSOutlineView That Couldn't
- From: David Wood <email@hidden>
- Date: Mon, 9 Jun 2003 12:11:43 -0400
On Monday, June 9, 2003, at 09:40 AM, olivier wrote:
when you call reloadData, did you check that the method -
(int)outlineView:(NSOutlineView *)outlineView
numberOfChildrenOfItem:(id)item of your datasource is called?
If not that mean that the outlineview lost track of its data source.
Gah! Good call, that!
Here's what I did wrong: I defined SSDocument (the NSDocument subclass)
to link to the NSOutlineView as a delegate. I created a dedicated
NSObject subclass to act as the data source, to add and delete data to
the internal array (pointers to the other arrays of information this
thing is going to have to track -- like I said, this is gonna get
hideously complex.)
***But I never told the data source about the NSOutlineView! ***
I stuck an extra accessor method into the data source and had the
SSDocument call it when it had the dynamic binding to the
NSOutlineView. Now it works as expected.
When you call reloadData, take a look a the data source and check it
is still valid.
Which is how I finally figured that out. NSLog() Is Your Friend. Thanks
for the tipoff.
--David
http://skipjack.bluecrab.org/~dwood
"I had REALLY high hopes when I saw the URL
http://www.furby.com/furby/breaking.htm ...but the blasted thing is
just a news page."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.