luis713 Posted March 9, 2018 Posted March 9, 2018 (edited) Hi, I have two combos and what I want to do is this: -Combo one has the letters from A to Z -If user selects "A" in combo one the combo two must show the letters from B to Z -If user selects "B" in combo one the combo two must show the letters from C to Z -If user selects "C" in combo one the combo two must show the letters from D to Z and so on. this is a short example of the code that I have but I need to improve it, any idea? I noticed when I change my choice in combo one after two times it changes the order Thanks in advance expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiComboBox.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Local $combo1 = GUICtrlCreateCombo("A", 20, 50, 50, 20, $CBS_DROPDOWNLIST) For $i = 65 to 90 GUICtrlSetData(-1, chr($i)) Next Local $combo2 = GUICtrlCreateCombo("", 20, 80, 50, 20, $CBS_DROPDOWNLIST) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $Combo1 If Guictrlread($Combo1) = "A" Then For $i = 66 to 90 GUICtrlSetData($Combo2, chr($i)) Next EndIf If Guictrlread($Combo1) = "B" Then For $i = 67 to 90 GUICtrlSetData($Combo2, chr($i)) Next EndIf If Guictrlread($Combo1) = "C" Then For $i = 68 to 90 GUICtrlSetData($Combo2, chr($i)) Next EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Edited March 9, 2018 by luis713
Zedna Posted March 9, 2018 Posted March 9, 2018 Case $Combo1 $c = Guictrlread($Combo1) $n = Asc($c) GUICtrlSetData($Combo2, '|') ; reset previous values For $i = $n+1 to 90 GUICtrlSetData($Combo2, chr($i)) Next Resources UDF ResourcesEx UDF AutoIt Forum Search
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