UDF > GUI > GuiComboBox >


_GUICtrlComboBox_GetLBText

Obtient une chaîne dans la liste déroulante d'une ComboBox

#include <GuiComboBox.au3>
_GUICtrlComboBox_GetLBText ( $hWnd, $iIndex, ByRef $sText )

Paramètres

$hWnd ID/handle du contrôle
$iIndex Index, à partir de 0, d'où récupérer la chaîne
$sText Variable qui recevra la chaîne

Valeur de retour

Succès: Retourne le texte de la chaîne.
Échec: Retourne -1.

En relation

_GUICtrlComboBox_GetLBTextLen

Exemple

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $sText, $idCombo

    ; Crée une GUI
    GUICreate("ComboBox Get LB Text", 400, 296)
    $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    GUISetState(@SW_SHOW)

    ; Ajoute des fichiers
    _GUICtrlComboBox_BeginUpdate($idCombo)
    _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($idCombo)

    ; Obtient LB Text
    _GUICtrlComboBox_GetLBText($idCombo, 2, $sText)
    MsgBox($MB_SYSTEMMODAL, "Information", "LB Text: " & $sText)

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