Funktionreferenz


_GUICtrlTreeView_GetState

Beschreibung anzeigen in

Ermittelt den Status eines Items

#include <GuiTreeView.au3>
_GUICtrlTreeView_GetState ( $hWnd [, $hItem = Null] )

Parameter

$hWnd Control-ID / Handle des Controls
$hItem [optional] Item ID/Handle

Rückgabewert

Erfolg: Der Status eines Items
Fehler: Setzt das @error Flag auf ungleich null

Bemerkungen

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

_GUICtrlTreeView_SetState

Beispiel

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    GUICreate("TreeView: Setzt und ermittelt den Status (v" & @AutoItVersion & ")", 500, 300)

    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    Local $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    ; Setzt das ANSI Format
;~     _GUICtrlTreeView_SetUnicodeFormat($idTreeView, False)

    _GUICtrlTreeView_BeginUpdate($idTreeView)
    Local $aidItem[10]
    For $x = 0 To 9
        $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] Neues Item", $x), $idTreeView)
        For $y = 1 To Random(2, 10, 1)
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] Neues Child", $y), $aidItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate($idTreeView)

    Local $iRand = Random(0, 9, 1)
    _GUICtrlTreeView_SetSelected($idTreeView, $aidItem[$iRand])
    MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Status für Index %d? %s", $iRand, _GUICtrlTreeView_GetState($idTreeView, $aidItem[$iRand])))
    MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Status für Index %d? %s", 0, _GUICtrlTreeView_GetState($idTreeView)))

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example