SerLanceloth Posted May 9, 2015 Share Posted May 9, 2015 (edited) hello everyone i have been looking for help to set 3 comboboxes that work depending on each other (combo2 have diferent options depending on whats selected on combo1, same with comobo 3 and 2), once the level are selected to set text into an edit box depending on the selected levelbtw if can explain with note would be awesome, im still learning Edited May 9, 2015 by SerLanceloth Link to comment Share on other sites More sharing options...
galan2015 Posted May 9, 2015 Share Posted May 9, 2015 (edited) Case $Combo4; Stany $ReadCombo = GUICtrlRead($Combo4) if $ReadCombo = "Your 1 Option" then $Data = "Moto|Pish|Helo" ; data to change GUICtrlSetData($Combo5,$Data) ; change data in $Combo5 ElseIf $ReadCombo = "Your 2 Option" then $Data = "Helo|Moto|Pish" GUICtrlSetData($Combo5,$Data) Endif I add this into my case in while Edited May 9, 2015 by galan2015 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2015 Moderators Share Posted May 9, 2015 SerLanceloth,Welcome to the AutoIt forums.I explained how this might be done in this thread. Please ask again if you still have any questions after reading the code.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
galan2015 Posted May 9, 2015 Share Posted May 9, 2015 SerLanceloth,Welcome to the AutoIt forums.I explained how this might be done in this thread. Please ask again if you still have any questions after reading the code.M23What about mine solution? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2015 Moderators Share Posted May 9, 2015 galan2015,When I started composing my post you had not yet posted yours - it happens a lot so please do not think anything of it.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
galan2015 Posted May 9, 2015 Share Posted May 9, 2015 I asked if my way is good? Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 10, 2015 Author Share Posted May 10, 2015 I add this into my case in while thnks im goin to try it and see if i can make it work the way i need Link to comment Share on other sites More sharing options...
kylomas Posted May 10, 2015 Share Posted May 10, 2015 (edited) SirLanceloth,An example...expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiComboBox.au3> Local $hGui010 = GUICreate('Combo Demo', 340, 200) Local $cCombo1 = GUICtrlCreateCombo('', 10, 30, 100, 50) Local $cCombo2 = GUICtrlCreateCombo('', 120, 30, 100, 50) Local $cCombo3 = GUICtrlCreateCombo('', 230, 30, 100, 50) ; combo1 string Local $sCombo1 = '|Breakfast|Lunch|Dinner' ; combo2 array Local $aCombo2[3][5] = [ _ ['Breakfast', 'Eggs', 'Sausage', 'Biskets'], _ ['Lunch', 'Hamburger', 'Daily Special', 'Meat Loaf'], _ ['Dinner', 'Steak', 'Fish', 'Lasagna']] ; combo3 array Local $aCombo3[9][5] = [ _ ['Eggs', 'Over Easy', 'Scrambled', 'Sunny Side Up'], _ ['Sausage', 'Links', 'Patties'], _ ['Biskets', 'Toasted', 'Buttered'], _ ['Hamburger', 'Fries', 'Soup', 'Salad'], _ ['Daily Special', 'Soup', 'Salad'], _ ['Meat Loaf', 'Soup', 'Salad', 'Potato'], _ ['Steak', 'Rare', 'Medium', 'Well'], _ ['Fish', 'Cod', 'Pollock', 'Perch'], _ ['Lasagna', 'Soup', 'Salad', 'Potato']] Local $sCombo2, $sCombo3 GUICtrlSetData($cCombo1, $sCombo1) GUICtrlSetData($cCombo1, _GUICtrlComboBox_GetListArray($cCombo1)[1]) GUISetState() While 1 Switch GUIGetMsg() Case $gui_event_close Exit Case $cCombo1 For $i = 0 To UBound($aCombo2) - 1 If StringStripWS(GUICtrlRead($cCombo1), 3) = $aCombo2[$i][0] Then $sCombo2 = '|' For $j = 1 To UBound($aCombo2, 2) If $aCombo2[$i][$j] = '' Then ExitLoop $sCombo2 &= $aCombo2[$i][$j] & '|' Next EndIf Next GUICtrlSetData($cCombo2, $sCombo2) GUICtrlSetData($cCombo2, _GUICtrlComboBox_GetListArray($cCombo2)[1]) Case $cCombo2 For $i = 0 To UBound($aCombo3) - 1 If StringStripWS(GUICtrlRead($cCombo2), 3) = $aCombo3[$i][0] Then $sCombo3 = '|' For $j = 1 To UBound($aCombo3, 2) If $aCombo3[$i][$j] = '' Then ExitLoop $sCombo3 &= $aCombo3[$i][$j] & '|' Next EndIf Next GUICtrlSetData($cCombo3, $sCombo3) GUICtrlSetData($cCombo3, _GUICtrlComboBox_GetListArray($cCombo3)[1]) Case $cCombo3 ConsoleWrite('You ordered ' & GUICtrlRead($cCombo1) & ', ' & GUICtrlRead($cCombo2) & ', ' & GUICtrlRead($cCombo3) & @CRLF) EndSwitch WEndSimilar to what M23 posted above except that the data for the combo controls is not externalized. As you can see, organizing your data and data relationships is the biggest part of this effort. It is always better to manage the data externally for ease of maintenance and flexibility with updates. I posted this as an example of how the controls might be managed.You will need to understand arrays for this code to make any sense to you. As a new user I would recommend searching the Wiki for various tutorials and reading the Help file.kylomas Edited May 10, 2015 by kylomas code not tidied Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 12, 2015 Author Share Posted May 12, 2015 Similar to what M23 posted above except that the data for the combo controls is not externalized. As you can see, organizing your data and data relationships is the biggest part of this effort. It is always better to manage the data externally for ease of maintenance and flexibility with updates. I posted this as an example of how the controls might be managed.You will need to understand arrays for this code to make any sense to you. As a new user I would recommend searching the Wiki for various tutorials and reading the Help file.kylomas how would it work on a global? i pretty much need everything to work around the levels selected on the combos Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 12, 2015 Author Share Posted May 12, 2015 (edited) #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 355, 172, 192, 124) $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "Item 2|Item 3", "") $Combo2 = GUICtrlCreateCombo("Combo2", 168, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo2, "Item 2|Item 3", "") $Edit1 = GUICtrlCreateEdit("", 8, 48, 185, 89) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndwhat im looking for is some way to do, this are different options for different levels, example if combo1 == item1 then combo2 options are 1|2|3, but if combo1 == item2 then combo2 options are 4|5|6, and depending on the levels selected edit1 must have text insertedif combo1 == item2 then combo2 GUICtrlSetData($Combo2, "Item 2|Item 3", "")if combo2 == item 3 then GUICtrlSetData($Edit1, "this text must be inserted", 1)please help, and explain if possible im new on autoit but im really looking forward to dominate it Edited May 12, 2015 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 12, 2015 Moderators Share Posted May 12, 2015 SerLanceloth,You already have a thread running on this - please stick to just the one at a time. Threads merged.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 12, 2015 Moderators Share Posted May 12, 2015 SerLanceloth,This script does what you said you required:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> $Form1 = GUICreate("Form1", 355, 172, 192, 124) $Combo1 = GUICtrlCreateCombo("", 8, 8, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "Item 2|Item 3") $Combo2 = GUICtrlCreateCombo("", 168, 8, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetState($Combo2, $GUI_DISABLE) $Edit1 = GUICtrlCreateEdit("", 8, 48, 185, 89) GUICtrlSetData($Edit1, "Edit1") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Combo1 Switch GUICtrlRead($Combo1) Case "Item 2" GUICtrlSetData($Combo2, "|Item 1|Item 2|Item 3") GUICtrlSetState($Combo2, $GUI_ENABLE) Case "Item 3" GUICtrlSetData($Combo2, "|Item 4|Item 5|Item 6") GUICtrlSetState($Combo2, $GUI_ENABLE) EndSwitch Case $Combo2 If GUICtrlRead($Combo2) = "Item 3" Then GUICtrlSetData($Edit1, "this text must be inserted", 1) EndIf EndSwitch WEndAs it is so simple to follow, I have not added any comments, but please do ask if you have any questions.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 13, 2015 Author Share Posted May 13, 2015 thanks melba this is exactly what I need it, and nice programing style Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 13, 2015 Moderators Share Posted May 13, 2015 SerLanceloth,Delighted I could help. But when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 13, 2015 Author Share Posted May 13, 2015 hey melba, con the combobox im using too many items, and I will need a scroll either with the mouse or a bar in the side, do you know, how can I do it? Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 13, 2015 Author Share Posted May 13, 2015 nevermind I found my way thnks Link to comment Share on other sites More sharing options...
SerLanceloth Posted May 20, 2015 Author Share Posted May 20, 2015 hello im back, im still working on my code and I need a new function that set the data of the buttons depending of what is selected on the combo#include <ButtonConstants.au3>#include <ComboConstants.au3>#include <EditConstants.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>$Form1 = GUICreate("Form1", 229, 295, 192, 124)$Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 169, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "|Item 1|Item 2|Item 3")$Button1 = GUICtrlCreateButton("Button1", 8, 40, 75, 25)$Button2 = GUICtrlCreateButton("Button2", 88, 40, 75, 25)$Edit1 = GUICtrlCreateEdit("", 0, 80, 193, 177)GUICtrlSetData(-1, "Edit1")GUISetState(@SW_SHOW)While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitchWEnd here is like an idea of flow of what im looking forif GUICtrlRead($combo1) = "Item 1" Then $Button1 sets edit1 data to yes and $button2 sets edit1 data to no if GUICtrlRead($combo1) = "Item 2" Then $Button1 sets edit1 data to yes2 and $button2 sets edit1 data to no2 if GUICtrlRead($combo1) = "Item 3" Then $Button1 sets edit1 data to yes3 and $button2 sets edit1 data to no3 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