bohmam Posted October 4, 2010 Share 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 Link to comment Share on other sites More sharing options...
notsure Posted October 4, 2010 Share Posted October 4, 2010 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIComboBox.au3> $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,115) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,140) global $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") GUISetState() While 1 $msg= GUIGetMsg() if $msg= $GUI_EVENT_CLOSE Then ExitLoop elseif $msg = $hCOMBO then _changecombo() EndIf WEnd Func _changecombo() $return=_GUICtrlComboBox_GetCurSel($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 EndFunc Edit: To avoid flickering text in input-text, place your Switchmethod only when the combo changes. Edited October 4, 2010 by notsure Link to comment Share on other sites More sharing options...
bohmam Posted October 4, 2010 Author Share Posted October 4, 2010 expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIComboBox.au3> $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,115) $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") $hGUI=GUICreate("COMBO" , 200 , 200 ) $hEDIT=GUICtrlCreateEdit("",10,50,150,140) global $hCOMBO=GUICtrlCreateCombo("Chose number" , 10 , 10 , 150 ) GUICtrlSetData($hCOMBO , "1|2|3") GUISetState() While 1 $msg= GUIGetMsg() if $msg= $GUI_EVENT_CLOSE Then ExitLoop elseif $msg = $hCOMBO then _changecombo() EndIf WEnd Func _changecombo() $return=_GUICtrlComboBox_GetCurSel($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 EndFunc Edit: To avoid flickering text in input-text, place your Switchmethod only when the combo changes. Thanks alot now all thing is OK Link to comment Share on other sites More sharing options...
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