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();
                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.


  • 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 ?


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

    Originally posted by: Ralf A.

    Why don't you use 


    instead of that recursive function?

  • Good tip~

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

    Originally posted by: grinbee

    thanx man~
    for the good tip...

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

Top White Papers and Webcasts

  • Thanks to the Internet of Things (IoT), physical assets are turning into participants in real-time global digital markets. The countless types of assets around us will become as easily indexed, searched and traded as any online commodity. While some industries will be tougher to transform than others – those with physical limitations, such as manufacturing, will be harder to digitize – untold economic opportunities exist for growth and advancement. Our research shows this will create a new "Economy …

  • As the mobile enterprise marketplace expands and customer needs grow more diverse, Samsung recognizes that solution partners and developers play an essential role by continually innovating to meet their customers' needs. Samsung works to provide these developers and partners with the latest tools and resources needed to create these solutions. Read this program guide to learn how the Samsung Enterprise Alliance Program provides partners and developers with Samsung enterprise software development kits (SDKs) …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date