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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to