UDF > GUI > GuiComboBox >


_GUICtrlComboBox_GetCurSel

Obtient l'index de l'�l�ment en cours de s�lection

#include <GuiComboBox.au3>
_GUICtrlComboBox_GetCurSel ( $hWnd )

Param�tre

$hWnd ID/handle du contr�le

Valeur de retour

Succ�s: Retourne l'index, � partir de 0, de l'�l�ment s�lectionn�.
�chec: Retourne -1.

En relation

_GUICtrlComboBox_SetCurSel

Exemple

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

Example()

Func Example()
    Local $idCombo

    ; Cr�e une GUI
    GUICreate("ComboBox Get Cur Sel", 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)

    ; S�lectionne un �l�ment
    _GUICtrlComboBox_SetCurSel($idCombo, 2)

    ; Obtient Cur Sel
    MsgBox($MB_SYSTEMMODAL, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel($idCombo))

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