lrstndm Posted June 28, 2012 Share Posted June 28, 2012 Hi all, I want to set the selected value in a combobox. How can i do this? For example: I have a combobox with 5 values: 1, 2, 3, 4 and 5 When I click on the button I want that the combox select the number 4. Thanks in advance, lrstndm Link to comment Share on other sites More sharing options...
PhoenixXL Posted June 28, 2012 Share Posted June 28, 2012 Please give your GUI code My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
lrstndm Posted June 28, 2012 Author Share Posted June 28, 2012 (edited) #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 160, 65, 192, 124) $Combo1 = GUICtrlCreateCombo("Number 1", 8, 8, 145, 25) $Button1 = GUICtrlCreateButton("Button1", 77, 32, 75, 25) GUISetState(@SW_SHOW) GUICtrlSetData($Combo1, 'Number 2|Number 3|Number 4|Number 5') While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $Button1 ; In here needs to come the code ; When you click on the button the combobox needs to select 'Number 2' value EndSelect WEnd Edited June 28, 2012 by lrstndm Link to comment Share on other sites More sharing options...
Zedna Posted June 28, 2012 Share Posted June 28, 2012 GUICtrlSetData() or _GUICtrlComboBox_SelectString() or _GUICtrlComboBox_SetCurSel() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted June 28, 2012 Share Posted June 28, 2012 #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> $Form1 = GUICreate("Form1", 160, 65, 192, 124) $Combo1 = GUICtrlCreateCombo("Number 1", 8, 8, 145, 25) $Button1 = GUICtrlCreateButton("Button1", 77, 32, 75, 25) GUISetState(@SW_SHOW) GUICtrlSetData($Combo1, 'Number 2|Number 3|Number 4|Number 5') While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 ; When you click on the button the combobox needs to select 'Number 2' value _GUICtrlComboBox_SelectString($Combo1, 'Number 2') EndSelect WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lrstndm Posted June 28, 2012 Author Share Posted June 28, 2012 Thank you Zedna. Thats it! 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