Obtient les positions du caractère de début et du caractère de fin de la sélection actuelle dans la zone de saisie d'une ComboBox
#include <GuiComboBox.au3>
_GUICtrlComboBox_GetEditSel ( $hWnd )
$hWnd | ID/handle du contrôle |
Succès: | Retourne un tableau dans le format suivant: [0] - Position de départ [1] - Position de fin |
Échec: | Définit @error <> 0. |
Si le message est envoyé à une ComboBox avec le style $CBS_DROPDOWN ou $CBS_DROPDOWNLIST, la fonction échouera.
_GUICtrlComboBox_SetEditSel, _GUICtrlComboBoxEx_SetEditSel
#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> Global $g_idMemo Example() Func Example() Local $aSel, $idCombo ; Crée une GUI GUICreate("ComboBox Get Edit Sel", 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) ; Sélectionne un élément _GUICtrlComboBox_SetCurSel($idCombo, 2) ; Définit une sélection _GUICtrlComboBox_SetEditSel($idCombo, 0, 4) ; Obtient la sélection $aSel = _GUICtrlComboBox_GetEditSel($idCombo) MemoWrite(StringFormat("Edit Sel: %d - %d", $aSel[0], $aSel[1])) ; 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