tdwg83 Posted May 20, 2008 Share Posted May 20, 2008 I am looking at using two combo boxes such that Combo1 is predefined and the listed returned in Combo2 is dependent on what is selected in Combo1. Does any one have any ideas on accomplishing. I can set defaults but can't get the list assigned to Combo2 to change. Link to comment Share on other sites More sharing options...
martin Posted May 20, 2008 Share Posted May 20, 2008 I am looking at using two combo boxes such that Combo1 is predefined and the listed returned in Combo2 is dependent on what is selected in Combo1. Does any one have any ideas on accomplishing. I can set defaults but can't get the list assigned to Combo2 to change.You can change the items by setting the list with the separator as the first character.GuiCtrlSetDat($Combo2,"|a|b|c|d|e","a"); set new list of items, default to "a" Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
tdwg83 Posted May 20, 2008 Author Share Posted May 20, 2008 For example: combobox 1 Lists: 1, 2, 3, 4, 5, 6 If You choose 1 second combo box lists A,B,C, If you choose 2 second combo box lists D, E, F etc.... Link to comment Share on other sites More sharing options...
rasim Posted May 21, 2008 Share Posted May 21, 2008 tdwg83Hi! Try this:#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> Global $aLetters[7] = [6, "ABC", "DEF", "GHI", "JKL", "MNO", "PQR"] $hGUI = GUICreate("Test GUI", 300, 200) $hCombo1 = GUICtrlCreateCombo("", 50, 50, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "1|2|3|4|5|6", 1) $hCombo2 = GUICtrlCreateCombo("", 50, 100, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "ABC|DEF|GHI|JKL|MNO|PQR", "ABC") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $hCombo1 $read = GUICtrlRead($hCombo1) GUICtrlSetData($hCombo2, $aLetters[$read], $aLetters[$read]) EndSwitch WEnd GUIDelete() $aLetters = 0 Link to comment Share on other sites More sharing options...
tdwg83 Posted May 21, 2008 Author Share Posted May 21, 2008 (edited) #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> Global $aLetters[7] = [6, "ABC", "DEF", "GHI", "JKL", "MNO", "PQR"] Global $aLetter2[7] = [6, "abc", "def", "ghi", "jkl", "mno", "pqr"] $hGUI = GUICreate("Test GUI", 300, 200) $hCombo1 = GUICtrlCreateCombo("", 50, 50, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "1|2|3|4|5|6", 1) $hCombo2 = GUICtrlCreateCombo("", 50, 100, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $hCombo1 $read = GUICtrlRead($hCombo1) If $read = 1 Then GUICtrlSetData($hCombo2, "ABC|DEF|GHI|JKL|MNO|PQR", "ABC") If $read = 2 Then GUICtrlSetData($hCombo2, "abc|def|ghi|jkl|mno|pqr", "def") EndSwitch WEnd GUIDelete() $aLetters = 0 Modified version. Problem is combo box 2 doesn't clear just adds to the list NEVERMIND just had to start the lists with "|" Thanks all Edited May 21, 2008 by tdwg83 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