Jump to content

Recommended Posts

Posted

I hacked up one of the TreeView UDFs to come up with this:

;===============================================================================
;
; Description:      _GUICtrlTreeViewWalkTree
; Parameter(s):     $i_treeview - controlID
; Requirement:          None
; Return Value(s):  None
; User CallTip:     _GUICtrlTreeViewWalkTree($i_treeview) Walk tree view hierarchy (required: <GuiTreeView.au3>)
; Author(s):            basher
; Note(s):          
;
;===============================================================================
Func _GUICtrlTreeViewWalkTree($i_treeview)
    Local $h_item, $hChild, $chk
    
    $h_item = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_ROOT, 0)
    While $h_item > 0
        $itext = _GUICtrlTreeViewGetText($i_treeview, $h_item)
        $chk = BitAND( _GUICtrlTreeViewGetState($i_treeview, $h_item), 8192)
        ; this is just example code, do what you will on a checked item
        if $chk = 8192 Then MsgBox(0, "Item", $itext & " is checked")

        $hChild = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_CHILD, $h_item)
        while $hChild > 0
            $itext = _GUICtrlTreeViewGetText($i_treeview, $hChild)
            $chk = BitAND( _GUICtrlTreeViewGetState($i_treeview, $hChild), 8192)
            ; this is just example code, do what you will on a checked item
            if $chk = 8192 Then MsgBox(0, "Item", $itext & " is checked")
            $hChild = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_NEXT, $hChild)
        WEnd
        $h_item = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_NEXT, $h_item)
    WEnd
EndFunc   ;==>_GUICtrlTreeViewWalkTree

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
  • Recently Browsing   0 members

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