#include #include #include Opt("GUIOnEventMode", 1) Global $aItems[16] $hGUI = GUICreate("Treeview Example", 220, 320) $hTreeView = GUICtrlCreateTreeView(10, 10, 200, 300) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") $tParent = GUICtrlCreateTreeViewItem("Parent", $hTreeView) GUICtrlSetOnEvent($hTreeView, "_Get_Info") For $i = 1 To 15 $aItems[$i] = GUICtrlCreateTreeViewItem("Item " & $i, $tParent) GUICtrlSetOnEvent($aItems[$i], "_Get_Info") Next _GUICtrlTreeView_Expand($hTreeView) While 1 Wend Func _Get_Info() Local $ID = GUICtrlRead($hTreeView) Local $Handle = _GUICtrlTreeView_GetItemHandle($hTreeView, $ID) Local $Text = _GUICtrlTreeView_GetText($hTreeView, $Handle) Msgbox(0, "Treeview Example", "ID = " & $ID & @CRLF & "Handle = " & $Handle & @CRLF & "Text = " & $Text & @CRLF) EndFunc Func _Close() Exit EndFUnc