Jump to content
Sign in to follow this  
oren

GUICtrlCreateTreeView $TVS_CHECKBOXES

Recommended Posts

oren

I working with tree list now and i have a litle problem, I need to make a box half clicket if the box childrends are clicket, but not all of them are clicket,

This is what i built soo far.

#include <TreeviewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiTreeView.au3>
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("Boxs",200,200)
GUISetState(@SW_SHOW)
$hTreeView = GUICtrlCreateTreeView(2, 2, 150, 150, $iStyle, $WS_EX_CLIENTEDGE)

_GUICtrlTreeView_BeginUpdate($hTreeView)
       ;$hItem = _GUICtrlTreeView_Add($hTreeView, 0, "tools")
    $i=5
    $hItem = _GUICtrlTreeView_Add($hTreeView, 0, "tools")
                Dim $l = $i-1
                Dim $Name[$i]
                Dim $rum[$l+1][5]
                Dim $AllChecked = 0
                $Name[0]="sss"
                $Name[1]="www"
                $q=1
                $r=1
                Dim $z = 0
                Dim $falser
                For $i = 0 to $l Step 1 
                ConsoleWrite($i & "****")
                $rum[$i][0]=_GUICtrlTreeView_AddChild($hTreeView,$hItem, "main"&$i)
                for $r=1 to 4 Step 1 
                $rum[$i][$r]=_GUICtrlTreeView_AddChild($hTreeView, $rum[$i][0], "Sub"&$i)
                Next
                Next
                _GUICtrlTreeView_EndUpdate($hTreeView)
$AddToList=GUICtrlCreateButton("add",10,170)
 
 while 1
if true = _GUICtrlTreeView_GetChecked($hTreeView,$hItem) and $q = 1 Then
    _GUICtrlTreeView_Expand($hItem ,true)
    for $i=0 to $l step 1
        _GUICtrlTreeView_SetChecked($hTreeView,$rum[$i][0],true)
Next
$q = 0
EndIf
if $q=0 and False = _GUICtrlTreeView_GetChecked($hTreeView,$hItem) Then
    _GUICtrlTreeView_Expand($hItem ,true)
    for $i=0 to $l step 1
    _GUICtrlTreeView_SetChecked($hTreeView,$rum[$i][0],False)
Next
EndIf


For $i = 0 to $l step 1
    $falser=_GUICtrlTreeView_GetChecked($hTreeView,$rum[$i][0])
    if $falser= False then
        $AllChecked =0
        $q=1
        ExitLoop
    EndIf
$AllChecked = 1

Next
if $AllChecked = 1 and $z=1 Then 
    _GUICtrlTreeView_SetChecked($hTreeView,$hItem,true)
   $z=0
   EndIf
if $AllChecked = 0 and $z=0 Then 
    _GUICtrlTreeView_SetChecked($hTreeView,$hItem,False)
    $z=1
EndIf   
WEnd

This thing is nice because if you click all main childrends the main is been clicked, and if you click the main all the childrens are been unchecket,

Any way my question is if there a posibilty to make a checkbox half clicked?

Posted Image < ass you see in this picture one box is fully clicket and one is half clicket.

anyway to do something like that in autoit?

Edited by oren

Share this post


Link to post
Share on other sites
oren

great great great great.

Now all i have to do it to make it that you can only choose one subcategory in one time

http://www.autoitscript.com/forum/index.php?showtopic=79740

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.