CTreeCtrl and expanded nodes
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CTreeCtrl and expanded nodes

  1. #1
    Join Date
    May 1999
    Location
    Brighton, England
    Posts
    3

    CTreeCtrl and expanded nodes

    Hi all,

    Im probably missing something basic here, but does anyone know how i can test to see if a tree item node is currently expanded or not?

    Thanks
    Neil


  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,889

    Re: CTreeCtrl and expanded nodes


    if (GetItemState(hItem, TVIS_EXPANDED) & TVIS_EXPANDED)
    {
    // hItem is expanded
    }
    else
    // hItem is collapsed



    I've seen GetItemState return MORE states than the ones I asked it for, I've made it a habit to explicitly test the returned state again (sigh), hence the "& TVIS_EXPANDED" which shouldn't be required.


  3. #3
    Join Date
    Apr 2004
    Posts
    1

    Re: CTreeCtrl and expanded nodes

    Quote Originally Posted by OReubens View Post
    if (GetItemState(hItem, TVIS_EXPANDED) & TVIS_EXPANDED)
    {
    // hItem is expanded
    }
    else
    // hItem is collapsed



    I've seen GetItemState return MORE states than the ones I asked it for, I've made it a habit to explicitly test the returned state again (sigh), hence the "& TVIS_EXPANDED" which shouldn't be required.
    Thank you. I had just this problem and why your post had shown on a search. Fixed it in my ctrlext.ini as:
    CTLEXT_INLINE bool CTreeCursor::IsExpanded( ) const { return TreeView_GetItemState( *m_pTree, m_hTreeItem, TVIS_EXPANDED ) & TVIS_EXPANDED; }

    Best, Dan.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center