Jump to content

TreeView with Checkbox


atzoref
 Share

Recommended Posts

  • Moderators

atzoref,

Dog eaten your Help file? ;)

_GUICtrlTreeView_GetChecked sounds like a good candidate to me. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

How to disable one of Check Boxes of a Tree View? $GUI_DISABLE doesn't works or maybe i can't get it to work.

Take a look at this example please:

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
;--------------------------------------------------
GUICreate('TreeView Test', 400, 200)
Local $treTest[6] = [GUICtrlCreateTreeView(10, 10, 380, 180, BitOR($TVS_DISABLEDRAGDROP,$TVS_CHECKBOXES,$TVS_FULLROWSELECT))]
  $treTest[1] = GUICtrlCreateTreeViewItem('Item 1', $treTest[0])
   ;I want this one to be both Checked and Disabled
   GUICtrlSetState(-1, $GUI_DISABLE)
   GUICtrlSetState(-1, $GUI_CHECKED)
  $treTest[2] = GUICtrlCreateTreeViewItem('Item 2', $treTest[0])
  $treTest[3] = GUICtrlCreateTreeViewItem('Item 3', $treTest[0])
  $treTest[4] = GUICtrlCreateTreeViewItem('Item 4', $treTest[0])
   GUICtrlSetState(-1, $GUI_CHECKED)
  $treTest[5] = GUICtrlCreateTreeViewItem('Item 5', $treTest[0])
   GUICtrlSetState(-1, $GUI_CHECKED)
GUISetState()
;--------------------------------------------------
Do
;Idle
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

  • Moderators

atzoref,

How can I add an option when I'm mark a Parent all its childs will be marked too?

I show how to do that in this thread. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for quick reply Melba.

I found something and modified it, now it's working for me. I've decided to remove the Check Box instead of making it Checked and Disabled.

If you are interested here you go:

Func _TreeViewRemoveCheckbox($hWnd, $hItem)
$hItem = GUICtrlGetHandle($hItem)
Local $Struct = DllStructCreate('uint;uint;uint;uint;ptr;int;int;int;int;uint;int')
DllStructSetData($Struct, 1, 0x8)
DllStructSetData($Struct, 2, $hItem)
DllStructSetData($Struct, 3, 0)
DllStructSetData($Struct, 4, 0xF000)
GUICtrlSendMsg($hWnd, 0x110D, 0, DllStructGetPtr($Struct))
EndFunc
Link to comment
Share on other sites

  • Moderators

D4RKON3,

My reply was for atzoref as you can see from the quote. Please do not hijack the threads of others - just start your own. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba I check the thread, and I see If you check a child item it also check its parents,

but I want also the opposite - when I check a parent it will check all its including childs...

How to doo that?

Another question is what is the most useful method to scan all the tree and check which items have been checked and thak the names

of the items which have been checked.

Thanks for your help

Link to comment
Share on other sites

Melba I check the thread, and I see If you check a child item it also check its parents,

but I want also the opposite - when I check a parent it will check all its including childs...

How to doo that?

Another question is what is the most useful method to scan all the tree and check which items have been checked and thak the names

of the items which have been checked.

Thanks for your help

The second issue I solved by creat an array of item handles (Like the example) and then check one by one if checked.

But why when I creat tha array of the items handles the rest of the array cells is filled with the first item handle?

And what about the first issue how can I do it?

Thanks

Link to comment
Share on other sites

  • Moderators

atzoref,

Try this version: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiTreeView.au3>
#include <Array.au3>

; Create an array to hold the handles and checkstate of the treeview items
Global $aItems[17][3]

$winGUI = GUICreate("Food_Drink", 500, 500)

$tvItems = GUICtrlCreateTreeView(8, 16, 241, 305, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES), _
    $WS_EX_DLGMODALFRAME+$WS_EX_CLIENTEDGE)
    $hTV = GUICtrlGetHandle(-1) ; Get handle of the control - works better in the UDF commands used later on

$aItems[0][2] = GUICtrlCreateTreeViewItem("Food", $tvItems)
$aItems[0][0] = GuiCtrlGetHandle($aItems[0][2]) ; Set the [n][0] element to the handle of the item
$aItems[1][2] = GUICtrlCreateTreeViewItem("Fruit", $aItems[0][2])
$aItems[1][0] = GuiCtrlGetHandle($aItems[1][2])
$aItems[2][2] = GUICtrlCreateTreeViewItem("Apple", $aItems[1][2])
$aItems[2][0] = GuiCtrlGetHandle($aItems[2][2])
$aItems[3][2] = GUICtrlCreateTreeViewItem("Meat", $aItems[0][2])
$aItems[3][0] = GuiCtrlGetHandle($aItems[3][2])
$aItems[4][2] = GUICtrlCreateTreeViewItem("Steak", $aItems[3][2])
$aItems[4][0] = GuiCtrlGetHandle($aItems[4][2])
$aItems[5][2] = GUICtrlCreateTreeViewItem("Chicken", $aItems[3][2])
$aItems[5][0] = GuiCtrlGetHandle($aItems[5][2])
$aItems[6][2] = GUICtrlCreateTreeViewItem("Dairy", $aItems[0][2])
$aItems[6][0] = GuiCtrlGetHandle($aItems[6][2])
$aItems[7][2] = GUICtrlCreateTreeViewItem("Cheese", $aItems[6][2])
$aItems[7][0] = GuiCtrlGetHandle($aItems[7][2])
$aItems[8][2] = GUICtrlCreateTreeViewItem("Drinks", $tvItems)
$aItems[8][0] = GuiCtrlGetHandle($aItems[8][2])
$aItems[9][2] = GUICtrlCreateTreeViewItem("Water", $aItems[8][2])
$aItems[9][0] = GuiCtrlGetHandle($aItems[9][2])
$aItems[10][2] = GUICtrlCreateTreeViewItem("Fizzy", $aItems[8][2])
$aItems[10][0] = GuiCtrlGetHandle($aItems[10][2])
$aItems[11][2] = GUICtrlCreateTreeViewItem("Cola", $aItems[10][2])
$aItems[11][0] = GuiCtrlGetHandle($aItems[11][2])
$aItems[12][2] = GUICtrlCreateTreeViewItem("Juice", $aItems[8][2])
$aItems[12][0] = GuiCtrlGetHandle($aItems[12][2])
$aItems[13][2] = GUICtrlCreateTreeViewItem("OrangeJuice", $aItems[12][2])
$aItems[13][0] = GuiCtrlGetHandle($aItems[13][2])
$aItems[14][2] = GUICtrlCreateTreeViewItem("Hot Drinks", $aItems[8][2])
$aItems[14][0] = GuiCtrlGetHandle($aItems[14][2])
$aItems[15][2] = GUICtrlCreateTreeViewItem("Tea", $aItems[14][2])
$aItems[15][0] = GuiCtrlGetHandle($aItems[15][2])
$aItems[16][2] = GUICtrlCreateTreeViewItem("Coffee", $aItems[14][2])
$aItems[16][0] = GuiCtrlGetHandle($aItems[16][2])

; Create buttons to set/clear all
$hSet = GUICtrlCreateButton("Set All", 300, 10, 80, 30)
$hClear = GUICtrlCreateButton("Clear All", 300, 50, 80, 30)

GUISetState()

; This will store the last selected item to save time in the loop
$hLastSelected = 0

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hSet
            _Set_All()
        Case $hClear
            _Set_All(False) ; See the function code to see why we need to specify here and not in teh call above
    EndSwitch

    ; Get selected item
    $hSelected = _GUICtrlTreeView_GetSelection($hTV)

    ; Has it changed - we only need to get the index if it has
    If $hSelected <> $hLastSelected Then
        ; Get index of the newly selected item
        $iSelectedIndex = _ArraySearch($aItems, $hSelected)
        ; And save new selection
        $hLastSelected = $hSelected
    EndIf

    ; Now we check if the selected item check state matches the stored version
    If _GUICtrlTreeView_GetChecked($hTV, $hSelected) <> $aItems[$iSelectedIndex][1] Then

        ; If not we set the array to match so we do not repeat this on each pass
        $aItems[$iSelectedIndex][1] = _GUICtrlTreeView_GetChecked($hTV, $hSelected)

        ; And now we check/uncheck the related checkboxes
        Switch $aItems[$iSelectedIndex][1]
            Case True
                ; If checked then check the parents
                _Check_Parents($hSelected)
                ; If checked then check the children
                _Check_Children($hSelected, True)
            Case False
                ; Or uncheck the children
                _Check_Children($hSelected, False)
        EndSwitch
    EndIf

WEnd

Func _Check_Parents($hHandle)

    ; Get the handle of the parent
    $hParent = _GUICtrlTreeView_GetParentHandle($hTV, $hHandle)
    ; If there is no parent
    If $hParent = 0 Then
        Return
    EndIf
    ; Check the parent
    _GUICtrlTreeView_SetChecked($hTV, $hParent)
    ; Adjust the array
    $iIndex = _ArraySearch($aItems, $hParent)
    $aItems[$iIndex][1] = True
    ; And look for the grandparent and so on
    _Check_Parents($hParent)

EndFunc

Func _Check_Children($hHandle, $fState)

    ; Get the handle of the first child
    $hChild = _GUICtrlTreeView_GetFirstChild($hTV, $hHandle)
    ; If there is no child
    If $hChild = 0 Then
        Return
    EndIf
    ; Uncheck the child
    _GUICtrlTreeView_SetChecked($hTV, $hChild, $fState)
    ; Adjust the array
    $iIndex = _ArraySearch($aItems, $hChild)
    $aItems[$iIndex][1] = $fState
    ; Check for children
    _Check_Children($hChild, $fState)

    ; Now look for all grandchildren
    While 1
        ; Look for next child
        $hChild = _GUICtrlTreeView_GetNextChild($hTV, $hChild)
        ; Exit the loop if none found
        If $hChild = 0 Then
            ExitLoop
        EndIf
        ; Uncheck the child
        _GUICtrlTreeView_SetChecked($hTV, $hChild, $fState)
        ; Adjust the array
        $iIndex = _ArraySearch($aItems, $hChild)
        $aItems[$iIndex][1] = $fState
        ; Check for children
        _Check_Children($hChild, $fState)
        ; And then look for the next child
    WEnd

EndFunc

Func _Set_All($fState = True) ; This means that the value is True unless we set it otherwise when we call the function

    ; Loop through the array and set the checkboxes
    For $i = 1 To UBound($aItems) - 1
        _GUICtrlTreeView_SetChecked($hTV, $aItems[$i][0], $fState)
    Next

EndFunc

Any better? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

atzoref,

If you want to compare files, I recommend WinMerge - then you would not have to ask. ;)

I have amended the _Uncheck_Children function - it is now called _Check_Children and takes an additional parameter $fState. The new parameter is set to True/False and determines whether the children are to be checked/unchecked. It is called in this section:

; And now we check/uncheck the related checkboxes
Switch $aItems[$iSelectedIndex][1]
    Case True
        ; If checked then check the parents
        _Check_Parents($hSelected)
        ; If checked then check the children
        _Check_Children($hSelected, True)
    Case False
        ; Or uncheck the children
        _Check_Children($hSelected, False)
EndSwitch

But does it work as you want? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

when I mark a child it works like previously

but when I mark a parent it close the program for some reason :ermm:

I see you use the same function in the same function (_Check_Children) it suppose to be like that?

Edited by atzoref
Link to comment
Share on other sites

  • Moderators

atzoref,

Then post the code you are using and we will take a look at it. :)

it suppose to be like that?

Yes, it is called recursion - a very powerful and sometimes dangerous tool. If you want to know more about it - and why you need to be so very careful when using it - I recommend the Recursion tutorial in the Wiki. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

The only thing I change is this part:

; And now we check/uncheck the related checkboxes
Switch $aItems[$iSelectedIndex][1]
    Case True
        ; If checked then check the parents
        _Check_Parents($hSelected)
        ; If checked then check the children
        _Check_Children($hSelected, True)
    Case False
        ; Or uncheck the children
        _Check_Children($hSelected, False)
EndSwitch

And the add (_Check_Children) with adaptation to my names and variables

It mark one child, then the second child too but after that it suddenly close the program.

Link to comment
Share on other sites

  • Moderators

atzoref,

Last chance - post the code you are using or I stop helping. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

$trTestsView = GUICtrlCreateTreeView(40, 320, 250, 250, BitOR($GUI_SS_DEFAULT_TREEVIEW,$TVS_CHECKBOXES),$WS_EX_DLGMODALFRAME+$WS_EX_CLIENTEDGE)
$trTestsViewHandle = GUICtrlGetHandle(-1) ; Get handle of the control - works better in the UDF commands used later on
$trRegression = GUICtrlCreateTreeViewItem("Regression", $trTestsView)
$arrItems[0][0] = GuiCtrlGetHandle($trRegression)
$trFile = GUICtrlCreateTreeViewItem("File", $trRegression)
$arrItems[1][0] = GuiCtrlGetHandle($trFile)
$trFileSaveConfiguration = GUICtrlCreateTreeViewItem("Save configuration", $trFile)
$arrItems[2][0] = GuiCtrlGetHandle($trFileSaveConfiguration)
$trFileLoadParametersForBrowsing = GUICtrlCreateTreeViewItem("Load parameters for browsing", $trFile)
$arrItems[3][0] = GuiCtrlGetHandle($trFileLoadParametersForBrowsing)
$trFileLoadParametersToDevice = GUICtrlCreateTreeViewItem("Load parameters to device", $trFile)
$arrItems[4][0] = GuiCtrlGetHandle($trFileLoadParametersToDevice)
$trFileBrowseToLocalFolder = GUICtrlCreateTreeViewItem("Browse to local folder", $trFile)
$arrItems[5][0] = GuiCtrlGetHandle($trFileBrowseToLocalFolder)
$trFileGenerateNewLogFile = GUICtrlCreateTreeViewItem("Generate new log file", $trFile)
$arrItems[6][0] = GuiCtrlGetHandle($trFileGenerateNewLogFile)
$trFileExit = GUICtrlCreateTreeViewItem("Exit", $trFile)
$arrItems[7][0] = GuiCtrlGetHandle($trFileExit)

Func TreeViewCheckBoxes()  
$hLastSelected = 0
; Get selected item
    $hSelected = _GUICtrlTreeView_GetSelection($trTestsViewHandle)
; Has it changed - we only need to get the index if it has
    If $hSelected <> $hLastSelected Then
     ; Get index of the newly selected item
        $iSelectedIndex = _ArraySearch($arrItems, $hSelected)
        ; And save new selection
        $hLastSelected = $hSelected
Else
  $iSelectedIndex = _ArraySearch($arrItems, $hLastSelected)
    EndIf
    ; Now we check if the selected item check state matches the stored version
    If _GUICtrlTreeView_GetChecked($trTestsViewHandle, $hSelected) <> $arrItems[$iSelectedIndex][1] Then
        ; If not we set the array to match so we do not repeat this on each pass
        $arrItems[$iSelectedIndex][1] = _GUICtrlTreeView_GetChecked($trTestsViewHandle, $hSelected)
        ; And now we check/uncheck the related checkboxes
        Switch $arrItems[$iSelectedIndex][1]
   Case True
                ; If checked then check the parents
                _Check_Parents($hSelected)
    ; If checked then check the children
                _Check_Children($hSelected, True)
   Case False
                ; Or uncheck the children
                _Check_Children($hSelected, False)
        EndSwitch
    EndIf
EndFunc
Func _Check_Parents($hHandle)
    ; Get the handle of the parent
    $hParent = _GUICtrlTreeView_GetParentHandle($trTestsViewHandle, $hHandle)
    ; If there is no parent
    If $hParent = 0 Then
        Return
    EndIf
    ; Check the parent
    _GUICtrlTreeView_SetChecked($trTestsViewHandle, $hParent)
    ; Adjust the array
    $iIndex = _ArraySearch($arrItems, $hParent)
    $arrItems[$iIndex][1] = True
    ; And look for the grandparent and so on
    _Check_Parents($hParent)
EndFunc

Func _Check_Children($hHandle, $fState)
    ; Get the handle of the first child
    $hChild = _GUICtrlTreeView_GetFirstChild($trTestsViewHandle, $hHandle)
; If there is no child
    If $hChild = 0 Then
        Return
    EndIf
    ; Uncheck/Check the child
    _GUICtrlTreeView_SetChecked($trTestsViewHandle, $hChild, $fState)
    ; Adjust the array
    $iIndex = _ArraySearch($arrItems, $hChild)
    $arrItems[$iIndex][1] = $fState
    ; Check for children
    _Check_Children($hChild, $fState)
    ; Now look for all grandchildren
    While 1
        ; Look for next child
        $hChild = _GUICtrlTreeView_GetNextChild($trTestsViewHandle, $hChild)
        ; Exit the loop if none found
        If $hChild = 0 Then
   MsgBox(0,"T","T")
            ExitLoop
        EndIf
        ; Uncheck the child
        _GUICtrlTreeView_SetChecked($trTestsViewHandle, $hChild, $fState)
        ; Adjust the array
        $iIndex = _ArraySearch($arrItems, $hChild)
        $aItems[$iIndex][1] = $fState
        ; Check for children
        _Check_Children($hChild, $fState)
        ; And then look for the next child
    WEnd
EndFunc
Edited by atzoref
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...