Re: Peoblems with expanding items in NSOutlineView
Re: Peoblems with expanding items in NSOutlineView
- Subject: Re: Peoblems with expanding items in NSOutlineView
- From: j o a r <email@hidden>
- Date: Thu, 5 Jul 2001 01:41:10 +0200
This time with sample code!
On torsdag, juli 5, 2001, at 12:09 , Brendan Younger wrote:
I've been working with NSOutlineView too recently and the way I've been
handling this problem is to have a isDirty flag for each expandable
item. Then, in my dataSource, I check to see if the item is dirty, get
its new children and then return the number of children, each
individual child, etc. I think the oulineView goes through and if the
the number of children of an item is the same or the first one or two
items are the same as those in its internal storage, it skips updating
any more to save time. Please tell me if this solves your problem or
if you're speaking of a different one which I have yet to run up
against.
I don't think that we are talking about the same problem. I think that
what you are talking about is to catch a changed number of childrens to
an item that can be expanded. My problem is even simpler. When I display
my NSOutlineView all expandable items are always collapsed. How would I
be able to remember which items my user expanded in a previous session?
I tried to solve that by saving the information on which items were
expanded and then when re-launched I'd expand these items again in the
"outlineView: willDisplayCell: forTableColumn:item:" method using
[outlineView expandItem:item]. My problem is that when I do this, the
NSOutlineView doesn't refresh the view properly, as outlined in my
previous letter. My analysis is that the outline view decided how many
items to display before it got to "outlineView: willDisplayCell:
forTableColumn:item:" where I changed the total number of items in the
view by expanding one or more of them. I haved tried to call
"reloadItem" and "reloadData" afterwards, but it still doesn't display
properly - it does clear up if I manually rezizes the whole window
though.
I was trying to stay away from having to write some sample code to
illustrate this problem, but perhaps that was just stupid. Here goes:
http://homepage.mac.com/joar/testBug.tgz
Any help greatly appreciated!
Regards,
j o a r