#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
Dim $item[4]
Dim $iStyle = BitOR($TVS_HASBUTTONS, $TVS_HASLINES,$TVS_LINESATROOT,$TVS_CHECKBOXES)
GUICreate("TreeView Test", 350, 215)
$Treeview = GUICtrlCreateTreeView(5, 5, 340, 150, $iStyle, $WS_EX_CLIENTEDGE)
$hItem = GUICtrlCreateTreeViewItem("test", $Treeview)
$item[1] = GUICtrlCreateTreeViewItem("001", $hItem)
$item[2] = GUICtrlCreateTreeViewItem("002", $hItem)
$item[3] = GUICtrlCreateTreeViewItem("003", $hItem)
$hItem02 = GUICtrlCreateTreeViewItem("Understand?", $Treeview)
GUICtrlCreateTreeViewItem("004", $hItem02)
GUICtrlCreateTreeViewItem("005", $hItem02)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $hItem
If _GUICtrlTreeView_GetChecked($Treeview, $hItem) Then
_GUICtrlTreeView_SetChecked($Treeview, $item[1])
_GUICtrlTreeView_SetChecked($Treeview, $item[2])
_GUICtrlTreeView_SetChecked($Treeview, $item[3])
Else
_GUICtrlTreeView_SetChecked($Treeview, $item[1], False)
_GUICtrlTreeView_SetChecked($Treeview, $item[2], False)
_GUICtrlTreeView_SetChecked($Treeview, $item[3], False)
EndIf
EndSwitch
WEnd
|