Obtient le texte de la zone de saisie d'une ComboBox
#include <GuiComboBox.au3>
_GUICtrlComboBox_GetEditText ( $hWnd )
$hWnd | ID/handle du contrôle |
Succès: | Retourne la chaîne de la zone de saisie du ComboBox. |
Échec: | Retourne une chaîne vide. |
Si le message est envoyé à une ComboBox avec le style $CBS_DROPDOWN ou $CBS_DROPDOWNLIST, la fonction échouera.
_GUICtrlComboBox_SetEditText, _GUICtrlComboBoxEx_SetEditText
#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> Global $g_idMemo Example() Func Example() Local $idCombo ; Crée une GUI GUICreate("ComboBox Get Edit Text", 400, 296) $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) ; Ajoute des fichiers _GUICtrlComboBox_BeginUpdate($idCombo) _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($idCombo) ; Définit du texte dans la zone de saisie _GUICtrlComboBox_SetEditText($idCombo, StringFormat("%d - Some New Text", Random(1, 20, 1))) ; Obtient le texte MemoWrite("Edit Text: " & _GUICtrlComboBox_GetEditText($idCombo)) ; Boucle jusqu'à ce que l'utilisateur quitte Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Ecrit une ligne dans le contrôle Mémo Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite