Collapsing all branches

Have you ever had the experience that you have expanded the outline at various points causing a lot of items to be visible and then finding it difficult to locate a particular item. Well, it happens with me all the time. So heres the code that will collapse all the branches in the outline as if the treeview control has just been initialized with the data.
 
// CollapseAll  - Collapses the complete outline.
void CTreeCtrlX::CollapseAll()
{
        HTREEITEM hti = GetRootItem();
        do{
                CollapseBranch( hti );
        }while( (hti = GetNextSiblingItem( hti )) != NULL );
}
This uses the function we developed for collapsing a branch. It goes through all the root items and collapses them.



Comments

  • How to create a treeview and display it in list view ?

    Posted by pean on 05/23/2007 01:35am

    can you guid specific me how to create a treeview and display it in list view ?

    Reply
  • What about TVE_COLLAPSERESET?

    Posted by Legacy on 02/24/2004 12:00am

    Originally posted by: Ralf A.

    Why don't you use 
    
    

    Expand(hti,TVE_COLLAPSE | TVE_COLLAPSERESET);

    instead of that recursive function?

    Reply
  • Good tip~

    Posted by Legacy on 12/03/2002 12:00am

    Originally posted by: grinbee

    thanx man~
    for the good tip...

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds