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

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

  • Managing your company's financials is the backbone of your business and is vital to the long-term health and viability of your company. To continue applying the necessary financial rigor to support rapid growth, the accounting department needs the right tools to most efficiently do their job. Read this white paper to understand the 10 essentials of a complete financial management system and how the right solution can help you keep up with the rapidly changing business world.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds