• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fastest way to "ExpandAll" in NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to "ExpandAll" in NSOutlineView


  • Subject: Re: Fastest way to "ExpandAll" in NSOutlineView
  • From: Darkshadow <email@hidden>
  • Date: Tue, 6 Jun 2006 04:03:29 -0400


On Jun 06, 2006, at 2:07 AM, James Bucanek wrote:

Sanford Selznick wrote on Monday, June 5, 2006:

I'd like to expand-/collapse-all cells in an NSOutlineView
programmatically.  The code below runs fine, but is slow once there
are more than a few hundred rows in the NSOutlineView.

Try using

    [tableView expandItem:rootItem expandChildren:YES]
or
    [tableView collapseItem:rootItem collapseChildren:YES]



Those will only expand or collapse the root item's children, and not children of the children (and so on), though. That's probably fine, from the user's point of view. Just wanted to point that out.


I don't know if this will speed up the code any, but you can do a test to see if an item is expandable, then expand or collapse it if it is.

for (int c = 0; c < [ov numberOfRows]; c++) {
    id item = [ov itemAtRow:c];
    if ( [ov isExpandable:item] ) {
	if ( expand ) {
	    [ov expandItem:item];
	} else {
	    [ov collapseItem:item];
	}
    }
}


Darkshadow (aka Michael Nickerson)



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: Fastest way to "ExpandAll" in NSOutlineView
      • From: Jeremy Dronfield <email@hidden>
References: 
 >Re: Fastest way to "ExpandAll" in NSOutlineView (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: Fastest way to "ExpandAll" in NSOutlineView
  • Next by Date: Re: Fastest way to "ExpandAll" in NSOutlineView
  • Previous by thread: Re: Fastest way to "ExpandAll" in NSOutlineView
  • Next by thread: Re: Fastest way to "ExpandAll" in NSOutlineView
  • Index(es):
    • Date
    • Thread