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

  • Mobile application management (MAM) refers to the workflow for security, governance, and distribution of mobile apps in the enterprise. Best-of-breed MAM provides app-level security for any app, deploys apps to every user in the extended enterprise because it is device management agnostic, manages the complete app lifecycle, and enables multiple app distribution methods, including an intuitive, custom-brandable enterprise app store. But, not all mobile application management (MAM) is created equal. Use this …

  • Enterprise cloud adoption has evolved rapidly from fringe curiosity to the mainstream. As enterprises increasingly move mission-critical workloads to the cloud, it's important to track best practices to ensure a seamless migration process. While CIOs are becoming increasingly mature and pragmatic in their approach to cloud, surprises and challenges still need to be addressed. Read this eBook to learn the key best practices for cloud deployment success, the importance of SLAs in choosing a cloud provider, and …

Most Popular Programming Stories

More for Developers

RSS Feeds

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