CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2000
    Posts
    66

    How to make a plus sign before the children of a tree?


    As far as I know, in TreeView control, if any of the leaf of the tree has no child, then
    there will no be a 'plus' sign befor the line. But I have a problem. Before the user click
    the plus sign, I will not query the children leaf of the present one. so I need the plus
    before the user click it (if after user's click there's no children, then the plus will disappear)
    You know, if I query all of the tree, it will cost me a very long time to build the tree ).
    So I have to query it when the user need it.


    I try to find some settings on the Treeview control , but failed. Any one can give me some hints?

    //-----------------------------------------\\
    Where there's a wire , there's a way
    \\-----------------------------------------//

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: How to make a plus sign before the children of a tree?

    For every node you add, you add a dummy node. This will make the treeview show a plus sign. Then when the user clicks the plus sign (use the expand event of the treeview) remove the dummy, and add the real ones (if any).

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured