Re: [NSOutlineView] How to know an item is expanded if its parent item is not?
Re: [NSOutlineView] How to know an item is expanded if its parent item is not?
- Subject: Re: [NSOutlineView] How to know an item is expanded if its parent item is not?
- From: Stéphane Sudre <email@hidden>
- Date: Sun, 2 Mar 2008 16:23:35 +0100
On Mar 2, 2008, at 5:24 AM, Seth Willits wrote:
On Mar 1, 2008, at 6:01 PM, John Stiles wrote:
Unless Stephane plans on manually tracking the expanded items
himself, I don't see how this answers his original question
That's what you have to do. I use these notifications to save which
items are expanded as part of my documents' data. It's not
particularly hard since at the very least, all you do is just keep
an array of expanded items.
It might not be hard but it does not work.
Let's say I have the following hierarchy:
Group --+-- Group 1
|
+-- Group 2
|
+-- Group 3
First, I don't implement notifications:
1. I disclose Group with the mouse
2. I disclose Group 1, Group 2, Group 3 with the mouse
3. I close Group
4. I disclose Group
=> Group 1, Group 2 and Group 3 are disclosed.
Then I implement outlineViewItemWillExpand: and
outlineViewItemWillCollapse: notifications and see what happens when
I follow the same procedure:
1. I disclose Group with the mouse
=> I receive a outlineViewItemWillExpand: notification for Group
2. I disclose Group 1, Group 2, Group 3 with the mouse
=> I receive outlineViewItemWillExpand: notifications for Group 1,
Group 2 and Group 3
3. I close Group
=> I receive a outlineViewItemWillCollapse: notification for Group
AND outlineViewItemWillCollapse: notifications for Group 1, Group 2
and Group 3
4. I disclose Group
=> I receive a outlineViewItemWillExpand: notification for Group AND
outlineViewItemWillExpand: notifications for Group 1, Group 2 and
Group 3
So, apparently, it's just not that easy. And one thing to take into
account in the array is the order in which items are listed because
you need to have the correct order, otherwise the parent of an item
may be processed after the item itself - which is not good -.
Maybe a solution could be to check if one of the parents for a group
is collapsed or not before taking into account the notification...
Anyway, wouldn't it be much easier if the cache used by NSOutlineView
(since it remembers which children were to be expanded) was accessible.
_______________________________________________
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