Re: Fastest way to "ExpandAll" in NSOutlineView
Re: Fastest way to "ExpandAll" in NSOutlineView
- Subject: Re: Fastest way to "ExpandAll" in NSOutlineView
- From: James Bucanek <email@hidden>
- Date: Tue, 6 Jun 2006 07:25:01 -0700
Jeremy Dronfield wrote on Tuesday, June 6, 2006:
>
>On 6 Jun 2006, at 9:03 am, Darkshadow wrote:
>
>> Those will only expand or collapse the root item's children, and
>> not children of the children (and so on), though.
>
>This is wrong. -expandItem:expandChildren: is recursive; it expands
>the item, its children and children's children etc. -
>collapseItem:collapseChildren: is also recursive.
Jeremy's correct. But I will point out one quirk about expandItem:expandChildren:. While it's behaviour is recursive, the method itself it not. That is, it doesn't call itself with each child that its going to expand or collapse.
I discovered this fact when overriding the method in attempt to short-curcuit its normal behavior. I have an outline browser that could potentially expand to millions of records, each of which must be read from a database. Allowing the user to option-click one of the top-level nodes would have been a disaster. I thought that I could override this and allow one or two levels of children to be expanded, but change the expandChildren: argument to NO for anything deeper than that -- but it doesn't work that way.
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden