#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $msg
GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
GUICtrlCreateCombo("item1", 10, 10) ; create first item
GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new default
GUISetState()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example
pas facile a trouver faut dire, c'est bien caché dans la doc :p
donc, GUIGetMsg() renvoi l'ID de la combobox quand on l'utilise, comme pour tout les autre control
#include <GuiComboBoxEx.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)
Global $hGUI, $combo, $hCombo
$hGUI = GUICreate("ComboBoxEx Create", 400, 300)
$combo = GUICtrlCreateCombo("item1", 10, 10) ; create first item
$hCombo = GUICtrlGetHandle($combo)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode
$hWndFrom = $ilParam
$iIDFrom = _WinAPI_LoWord($iwParam)
$iCode = _WinAPI_HiWord($iwParam)
Switch $hWndFrom
Case $hCombo
Switch $iCode
Case $CBN_EDITUPDATE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
ConsoleWrite("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
Case $CBN_SELCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
ConsoleWrite("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
EndSwitch
EndSwitch
EndFunc ;==>WM_COMMAND
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)