Teldin Posted February 19, 2007 Share Posted February 19, 2007 $p_data = GUICtrlCreateCombo("Change This", 70, 230, 430, 30) GUICtrlSetData($p_data, "data1|data2|data3|data4|data5|data6|data7|data8") Dim $p_value If GUICtrlRead($p_data) = "data1" Then $p_value = 0 ElseIf GUICtrlRead($p_data) = "data2" Then $p_value = 1 ElseIf GUICtrlRead($p_data) = "data3" Then $p_value = 2 ElseIf GUICtrlRead($p_data) = "data4" Then $p_value = 3 ElseIf GUICtrlRead($p_data) = "data5" Then $p_value = 4 ElseIf GUICtrlRead($p_data) = "data6" Then $p_value = 5 ElseIf GUICtrlRead($p_data) = "data7" Then $p_value = 6 ElseIf GUICtrlRead($p_data) = "data8" Then $p_value = 7 EndIf GuiCtrlCreateEdit($p_value, 10, 300, 120, 40) ;above line is just to test if the value is correct... Thanks in advance. Link to comment Share on other sites More sharing options...
Valuater Posted February 19, 2007 Share Posted February 19, 2007 (edited) Welcome to the forums ;$p_data = GUICtrlCreateCombo("Change This", 70, 230, 430, 30) ;GUICtrlSetData($p_data, "data1|data2|data3|data4|data5|data6|data7|data8") Dim $p_value = -1 For $x = 1 to 8 If StringInStr(GUICtrlRead($p_data), $x) Then $p_value += $x EndIf Next GuiCtrlCreateEdit($p_value, 10, 300, 120, 40) ;above line is just to test if the value is correct... 8) Edited February 19, 2007 by Valuater Link to comment Share on other sites More sharing options...
Teldin Posted February 19, 2007 Author Share Posted February 19, 2007 (edited) I actually posted a couple of times last week before the forums died, but those posts are lost. Anyways, thanks for the answer Valuater but I do need the user to choose between the "data" options in the combo box ($p_data) then that will determine the numberical value of $p_value. I tried to incorporate your fomula into mind with the combo box with no success. How would I do that? Edited February 19, 2007 by Teldin Link to comment Share on other sites More sharing options...
Teldin Posted February 20, 2007 Author Share Posted February 20, 2007 Any ideas? Link to comment Share on other sites More sharing options...
Shevilie Posted February 20, 2007 Share Posted February 20, 2007 Well.. what do you need to happen ?? Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Teldin Posted February 20, 2007 Author Share Posted February 20, 2007 The user selects 1 value ($p_data) choice from the combo box (or can be a radio box if needed) which is turned into a numerical value ($p_value) to be used later in the script. Link to comment Share on other sites More sharing options...
Shevilie Posted February 20, 2007 Share Posted February 20, 2007 Something like this #include <GUIConstants.au3> GUICreate("test", 200, 200) $p_data = GUICtrlCreateCombo("Change This", 10, 10, 100, 30) GUICtrlSetData($p_data, "data1|data2|data3|data4|data5|data6|data7|data8") GUISetState() do $msg = GUIGetMsg() IF $msg = $p_data Then Select Case GUICtrlRead($p_data) = "data1" $p_value = 1 Case GUICtrlRead($p_data) = "data2" $p_value = 2 Case GUICtrlRead($p_data) = "data3" $p_value = 3 Case GUICtrlRead($p_data) = "data4" $p_value = 4 Case GUICtrlRead($p_data) = "data5" $p_value = 5 Case GUICtrlRead($p_data) = "data6" $p_value = 6 Case GUICtrlRead($p_data) = "data7" $p_value = 7 Case GUICtrlRead($p_data) = "data8" $p_value = 8 EndSelect MsgBox(0,0,$p_value) EndIf until $msg = $GUI_EVENT_CLOSE Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Teldin Posted March 19, 2007 Author Share Posted March 19, 2007 I forgot to reply that your solution worked perfectly, thanks Shevilie. 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