Peoblems with expanding items in NSOutlineView
Peoblems with expanding items in NSOutlineView
- Subject: Peoblems with expanding items in NSOutlineView
- From: j o a r <email@hidden>
- Date: Wed, 4 Jul 2001 22:49:31 +0200
Hello,
I have a bunch of items in an NSOutlineView. I have implemented my own
trivial system to store their settings, like the expanded / collapsed
state, et.c. When the NSOutlineView is about to be displayed I check
which items should be expanded in this method:
- (void)outlineView: willDisplayCell: forTableColumn:item:
and call the [outlineView expandItem:item] / [outlineView
collapseItem:item] appropriately.
Now, the problem - as has been described previously on macosx-dev - is
that the outline view seems to have decided how many items to display
beforehand, and doesn't update that value based on wether I later
expand / collaps items or not. The result is that the list of items in
the outline view is cut off after the number of top level items.
Does this make sense? ;)
I think that Richard Schreyer described it better then I do:
On onsdag, februari 21, 2001, at 04:29 , Richard Schreyer wrote:
When I call reloadData after some change, the Outline View asks for the
number of items on the top level, and then only displays that number of
expanded items, cutting off the list halfway through (I might only have
5 top level items, but 9 total items that need to be displayed when
things are expanded.).
Resizing (and in this case, the drawer containing the outline opening)
the view causes the missing items to appear.
I've tried sending setNeedsDisplay:YES to the outline view right after
sending expandItem, but this had no effect.
Is there a way I can get the outline view to redisplay itself after it
creates new items?
Solutions to this problem, anyone? Should I change the expanded /
collapsed state on items somewhere else in the delegate / data source?
I think that you are supposed to be able to have the expanded /
collapsed state stored if you use the itemForPersistentObject /
persistentObjectForItem methods for the outlineView, but I cannot use
them in my app because of my data model that needs to be more flexible.
Regards,
j o a r