UDF > GUI > GuiTreeView >


_GUICtrlTreeView_FindItemEx

Extrait un noeud à partir d'un chemin sur l'arbre

#include <GuiTreeView.au3>
_GUICtrlTreeView_FindItemEx ( $hWnd, $sTreePath [, $hStart = 0] )

Paramètres

$hWnd Handle du contrôle
$sTreePath Le chemin à prendre, avec le séparateur de votre choix, voir Opt ("GUIDataSeparatorChar")
$hStart [optionnel] Noeud à partir duquel lancer la recherche. Si 0, le noeud racine est utilisé.

Valeur de retour

Succès: Retourne le handle du premier noeud qui correspond au chemin de l'arbre.
Échec: Retourne 0.

Remarque

La recherche est insensible à la casse

En relation

_GUICtrlTreeView_FindItem

Exemple

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

Example()

Func Example()
    Local $aidItem[10], $hItemFound, $idTmp_item , $idTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

    GUICreate("TreeView Find ItemEx", 400, 300)
    Opt("GUIDataSeparatorChar", "\")

    $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    _GUICtrlTreeView_BeginUpdate($idTreeView)
    For $x = 0 To 3
        $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $idTreeView)
        For $y = 0 To 2
            $idTmp_item  = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $aidItem[$x])
        Next
    Next
    $aidItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $idTmp_item)
    For $x = 5 To 9
        $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $idTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $aidItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate($idTreeView)

    $hItemFound = _GUICtrlTreeView_FindItemEx($idTreeView, "[03] New Item\[02] New Item\Looking for me?")
    If $hItemFound Then
        _GUICtrlTreeView_SelectItem($idTreeView, $hItemFound)
        MsgBox($MB_SYSTEMMODAL, "Information", "Item Found:" & @CRLF & "Handle: " & $hItemFound & @CRLF & "Text: " & _GUICtrlTreeView_GetText($idTreeView, $hItemFound))
    Else
        MsgBox($MB_SYSTEMMODAL, "Information", "Not Found")
    EndIf

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example