Funktionreferenz


_GUICtrlTreeView_GetLastChild

Beschreibung anzeigen in

Ermittelt das letzte Child-Item eines festgelegten Items

#include <GuiTreeView.au3>
_GUICtrlTreeView_GetLastChild ( $hWnd, $hItem )

Parameter

$hWnd Control-ID / Handle des Controls
$hItem Handle des Items

Rückgabewert

Erfolg: Das Handle des letzten Child-Items
Fehler: 0

Bemerkungen

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

Verwandte Funktionen

_GUICtrlTreeView_GetFirstChild, _GUICtrlTreeView_GetNextChild, _GUICtrlTreeView_GetPrevChild

Beispiel

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

Example()

Func Example()
    GUICreate("TreeView: Ermittelt das letzte Child (v" & @AutoItVersion & ")", 400, 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)

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

    Local $iRand = Random(0, 9, 1)
    MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Letztes Child für Item %d: %s", $iRand, _GUICtrlTreeView_GetLastChild($idTreeView, $aidTVi_Item[$iRand])))
    _GUICtrlTreeView_SelectItem($idTreeView, _GUICtrlTreeView_GetLastChild($idTreeView, $aidTVi_Item[$iRand]))

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