Code : Tout sélectionner
#include <GuiConstantsEx.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $Label_1, $Combo_2, $button1, $msg, $data , $test
GUICreate("MyGUI", 191, 157, (@DesktopWidth - 191) / 2, (@DesktopHeight - 157) / 2)
$Label_1 = GUICtrlCreateLabel("Label1", 30, 40, 131, 21, 0x1000)
$Combo_2 = GUICtrlCreateCombo("", 30, 60, 130, 21)
$test = GUICtrlSetData($Combo_2, "Item1|Item2|Item3|Item4|Item5")
$button1 = GUICtrlCreateButton("Set Label", 30, 90, 130, 20)
; Run the GUI until it is closed
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button1
$data = GUICtrlRead($Combo_2) ;Combo_2
GUICtrlSetData($Label_1, $data)
Case $msg = "Item1"
MsgBox(0,"","Item 1")
Case $msg = "Item2"
MsgBox(0,"","Item 2")
EndSelect
WEnd
Exit
EndFunc