Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
- Subject: Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
- From: Stéphane Sudre <email@hidden>
- Date: Thu, 26 Jun 2008 22:54:00 +0200
On Jun 26, 2008, at 10:30 AM, Manfred Schwind wrote:
I'm beginning to wonder if it's possible to save and restore the
current disclosure state of the hierarchy of a NSOutlineView.
I solved this a while ago. Here is what I am doing:
I am saving in my model if an item is expanded or collapsed. To
keep the model up-to-date, I am doing the following:
- In outlineViewItemDidExpand: I am setting my expanded flag in the
model to YES.
- In outlineViewItemWillCollapse: I am checking if the item is
currently "visible" and only if it's visible, I set my expanded-
flag to NO. To check if it is "visible" I am going up in the
hierarchy and look if some of the parents is collapsed. If one is
not expanded, I do not change the expanded flag. E.g. like so:
[...]
Looks like a good solution. I will try that.
Thanks.
_______________________________________________
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