Sign in to follow this  
Followers 0
galpha

CreateTreeview checkboxes

5 posts in this topic

Hi,

my program creates elements in a treeview dynamicly depending on certain conditions and all. It has also the $TVS_CHECKBOXES option so I can have checkboxes. Is it possible to only have all the Parent Items only have checkboxes and remove them for child.

Current code part for adding in tree:

$treeview = GUICtrlCreateTreeView(10, 80, 560, 290, BitOr($TVS_CHECKBOXES, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
For $i = 0 to UBound($reseau, 1) - 1   ;Remplir le GUI avec les pose et enlèvements
    $garder = StringCompare ( $reponse[$i], "RE")
    if $garder <> 0 Then
        $niv1[$i]   = GUICtrlCreateTreeViewitem($reseau[$i], $treeview)
        GUICtrlSetColor(-1, 0xFF0000)
    EndIf
Next
ProgressSet( 75,"75 %")

For $x = 0 to UBound($reseau, 1) - 1 ;boucle pour chaque pose/enlevement
    For $y = 0 to UBound($index, 1) - 1 ;boucler pour tester quel index prendre
        If ($index[$y] = $x) Then
            $niv2[$x] = GUICtrlCreateTreeViewitem($even_1[$y], $niv1[$x])
            GUICtrlSetColor(-1, 0x05033B)
            $niv3[$x] = GUICtrlCreateTreeViewitem($even_2[$y], $niv2[$x])
            GUICtrlSetColor(-1, 0x054E04)
        EndIf
    Next
Next

Basically, only the elements in the $niv1 array are the parents items (First For...Next loop)

Share this post


Link to post
Share on other sites



DK for sure, but have you looked at / tried GuiCtrlSetStyle() ?


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

DK for sure, but have you looked at / tried GuiCtrlSetStyle() ?

Yes but it seems I can only apply it to the whole tree.

Share this post


Link to post
Share on other sites

I seem to recall some MS treeviews that start out with checkboxes that disappear when you try to expand them and they don't have children, in Outlook 2000, maybe???...not quite the same thing, but perhaps it implies that what you want may be doable.

If you've tried setting the style for a given control id and aren't getting expected / desired behavior

then you have three options. I have no idea where this falls on the spectrum, but you ask good questions

and reply intelligently and I like to encourage suchlike ones. Your choices, IMO are:

1) change your expectations and desires :) Quick , easy, no muss no fuss.

2) If you're really, really sure it's possible (you've seen the feature implemented __with Microsoft Standard Controls__ elsewhere), or have

searched MSDN and found documentation that demonstrates feasibility, you might nicely ask for a feature request, including such information.

3) If you've seen the desired behavior _everywhere_ else, and au3 is the only place where you feel this necessary to your life feature is not present,

you might even, after carefully considering all aspects of reporting a possible bug, attempt to convince someone that the lack of the ability

to do what you want is a defect in the software that should be fixed.

all the best.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0