bohmam Posted October 4, 2010 Posted October 4, 2010 Hello guys what is wrong in these code expandcollapse popup#include <GUIConstantsEx.au3> $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,115) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") GUISetState() combo() Func combo() $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,140) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") While 1 $msg= GUIGetMsg() if $msg= $GUI_EVENT_CLOSE Then ExitLoop EndIf $return=GUICtrlRead($hCOMBO) Switch $return Case "1" GUICtrlSetData($hEDIT, " The number you are chose is (1) " ) Case "2" GUICtrlSetData($hEDIT, " The number you are chose is (2) " ) Case "3" GUICtrlSetData($hEDIT, " The number you are chose is (3) " ) EndSwitch WEnd EndFunc I'm want if I'm chose number from the combo list then print text in the edit space but the code is not work correctly wait your help Thanks
wakillon Posted October 4, 2010 Posted October 4, 2010 (edited) Another way...#include <GUIConstantsEx.au3> Opt ( "GuiOnEventMode", 1 ) Global $hGUI, $hEDIT $hGUI=GUICreate("COMBO" , 200 , 200 ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Exit", $hGUI ) $hEDIT=GUICtrlCreateEdit("",10,50,150,115) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetOnEvent ( $hCOMBO, '_ReadCombo' ) GUICtrlSetData($hCOMBO , "1|2|3") GUISetState() While 1 Sleep ( 20 ) WEnd Func _ReadCombo ( ) $_SelectedCombo = GUICtrlRead ( $hCOMBO ) ConsoleWrite ( "$_SelectedCombo : " & $_SelectedCombo & @Crlf ) GUICtrlSetData ( $hEDIT, " The number you are chose is (" & $_SelectedCombo & ") " ) EndFunc ;==> _Read ( ) Func _Exit ( ) Exit EndFunc ;==> _Exit ( )Delete duplicate topic or change title of One... Edited October 4, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0 - WIN 11 24H2 X64 - Other Examples Scripts
bohmam Posted October 4, 2010 Author Posted October 4, 2010 Another way... #include <GUIConstantsEx.au3> Opt ( "GuiOnEventMode", 1 ) Global $hGUI, $hEDIT $hGUI=GUICreate("COMBO" , 200 , 200 ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Exit", $hGUI ) $hEDIT=GUICtrlCreateEdit("",10,50,150,115) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetOnEvent ( $hCOMBO, '_ReadCombo' ) GUICtrlSetData($hCOMBO , "1|2|3") GUISetState() While 1 Sleep ( 20 ) WEnd Func _ReadCombo ( ) $_SelectedCombo = GUICtrlRead ( $hCOMBO ) ConsoleWrite ( "$_SelectedCombo : " & $_SelectedCombo & @Crlf ) GUICtrlSetData ( $hEDIT, " The number you are chose is (" & $_SelectedCombo & ") " ) EndFunc ;==> _Read ( ) Func _Exit ( ) Exit EndFunc ;==> _Exit ( ) Delete duplicate topic or change title of One... Thanks a lot , this is smart code!all thing is OK I'm so sorry to duplicate topic thats happen by wrong
wakillon Posted October 4, 2010 Posted October 4, 2010 Thanks a lot , this is smart code!all thing is OKI'm so sorry to duplicate topic thats happen by wrongDon't be worried about that and good continuation ! AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0 - WIN 11 24H2 X64 - Other Examples Scripts
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now