sliceofpie Posted September 4, 2010 Share Posted September 4, 2010 (edited) I'm trying to create different controls based on the combo box selection made. The issue is that it doesn't change the controls when I select another option from the combo box. Below is my code. I think I'm missing something but not sure what it is. Any help is appreciated. Thank you .expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData(-1, "Option2|Option3", "Option2") Switch GUICtrlRead($Combo1) Case "Option1" $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) Case "Option2" $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) Case "Option3" $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button1 = GUICtrlCreateButton("Button1", 16, 104, 115, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 24, 184, 97, 17) EndSwitch GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited September 4, 2010 by sliceofpie Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2010 Moderators Share Posted September 4, 2010 sliceofpie,The best way to do this is to create all the controls initially and then just show/hide them according to the combo option. The trick is to use _GUICtrlComboBox_GetDroppedState so that we do not action the various combo values until the selection is made - try removing that condition and see what happens! So your code becomes:expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData(-1, "Option2|Option3", "Option2") ; Create all controls and hide them $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $sCurrCombo = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; Wait until the combo is closed and then see if the value has changed If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo ; For each option, hide all controls and then just show the ones we want Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd Func _Hide_All() For $i = $Button1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFuncAll clear? 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...
AlmarM Posted September 4, 2010 Share Posted September 4, 2010 Func _Hide_All() For $i = $Button1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFunc Lol, didn't know that was possible. Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2010 Moderators Share Posted September 4, 2010 AlmarM,Only if you create the controls in IMMEDIATE sucession and do not delete any of them. AutoIt uses an internal array to keep track of created controls - hence the 65532 limit on controls per script. A new control takes the first available slot in the array and not the next highest - which is why the controls must be created in immediate succession and none deleted. Otherwise you have no idea what might be in that slot now! 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...
AlmarM Posted September 4, 2010 Share Posted September 4, 2010 Ah yes, that made sence. Thanks for explaining. Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
sliceofpie Posted September 4, 2010 Author Share Posted September 4, 2010 owee! Thanks M23! That worked great Link to comment Share on other sites More sharing options...
sliceofpie Posted September 5, 2010 Author Share Posted September 5, 2010 I modified the code a bit to include a button. When pressed, it will display the combo box with options to choose. It works great but how do I stop the combo box from flickering? expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $sCurrCombo = "",$sCurrGenericData = "", $var #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Button5 = GUICtrlCreateButton("Button5", 48, 256, 75, 25, $WS_GROUP) GUICtrlSetOnEvent($Button5, "ShowMenu") ; Create all controls and hide them $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData(-1, "Option2|Option3", "Option2") $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ShowMenu() Func ShowMenu() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 Show() EndSelect WEnd EndFunc Func Show() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch GUICtrlSetState($Combo1, $GUI_SHOW) If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd EndFunc Func _Hide_All() For $i = $Combo1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 5, 2010 Moderators Share Posted September 5, 2010 sliceofpie,Modified and over complicated! All you need to do is show the combo, not start a new loop: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $sCurrCombo = "", $sCurrGenericData = "", $var #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Button5 = GUICtrlCreateButton("Button5", 48, 256, 75, 25, $WS_GROUP) ;GUICtrlSetOnEvent($Button5, "ShowMenu") ; Not in OnEvent mode so useless <<<<<<<<<<<<<<<<<<<<<<<< ; Create all controls and hide them $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData(-1, "Option2|Option3", "Option2") $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ShowMenu() Func ShowMenu() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 GUICtrlSetState($Combo1, $GUI_SHOW) ; All you need do is to show the combo! <<<<<<<<<<<<<<<<<<<<<<<< EndSelect If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd EndFunc ;==>ShowMenu Func _Hide_All() For $i = $Combo1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFunc ;==>_Hide_AllIf you do not understand why I have commented out the GUICtrlSetOnEvent line, you need to re-read the Help file <GUI Reference - GUI Concepts> again. 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...
sliceofpie Posted September 5, 2010 Author Share Posted September 5, 2010 (edited) thanks for your response M23 I had overcomplicated this one . I don't know if its only on my machine but when I do this, it displays the options for the combo box without the combo box being there. When pressing "$Button5" it will then show the combo box. Edited September 5, 2010 by sliceofpie Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 5, 2010 Moderators Share Posted September 5, 2010 sliceofpie, Certainly does not do that for me! Try altering the combo creation code to this: $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData($Combo1, "Option2|Option3", "Option2") _GUICtrlComboBox_ShowDropDown($Combo1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This should force the combo to close. No guarantees - let me know what happens. 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...
sliceofpie Posted September 5, 2010 Author Share Posted September 5, 2010 (edited) Your answer makes sense but it wasn't what I wanted the script to do.I wasn't clear with what I'm trying to create so I'll be more specific .- When Showing the GUI, only Button5 should be viewable. - After pressing the button, the drop box should appear with drop down data and default values.This was kind of working (everything but the flickering) but it was too complicated.. so I modified it see below:expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $sCurrCombo = "",$sCurrGenericData = "", $var #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Button5 = GUICtrlCreateButton("Button5", 48, 256, 75, 25, $WS_GROUP) GUICtrlSetOnEvent($Button5, "ShowMenu") ; Create all controls and hide them $Combo1 = GUICtrlCreateCombo("Option1", 8, 16, 145, 25) GUICtrlSetData(-1, "Option2|Option3", "Option2") $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ShowMenu() Func ShowMenu() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 Show() EndSelect WEnd EndFunc Func Show() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch GUICtrlSetState($Combo1, $GUI_SHOW) If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd EndFunc Func _Hide_All() For $i = $Combo1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFuncbut I just can't get passed the flickering. I tried putting the combo box in an IF statement to stop it from redrawing.. like this:.... Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 $CurrCombo = $Combo1 Show() EndSelect Func Show() If $sCurrCombo = $Combo1 Then GUICtrlSetState($Combo1, $GUI_SHOW) $sCurrCombo = "" ....And it doesn't work. I apologize for not explaining myself clearly. I don't think I'm approaching this correctly. M23, maybe you tried telling me something that I'm not seeing . Edited September 5, 2010 by sliceofpie Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 5, 2010 Moderators Share Posted September 5, 2010 sliceofpie, - When Showing the GUI, only Button5 should be viewable. - After pressing the button, the drop box should appear with drop down data and default values. Try this: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $sCurrCombo = "Option 1", $sCurrGenericData = "", $var #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Button5 = GUICtrlCreateButton("Button5", 48, 256, 75, 25, $WS_GROUP) ; Create all controls and hide them $Combo1 = GUICtrlCreateCombo("", 8, 16, 145, 25) GUICtrlSetData(-1, "Option1|Option2|Option3", "Option 2") $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ShowMenu() Func ShowMenu() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 GUICtrlSetState($Combo1, $GUI_SHOW) EndSelect If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then ConsoleWrite(GUICtrlRead($Combo1) & @CRLF) $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd EndFunc ;==>ShowMenu Func _Hide_All() For $i = $Combo1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFunc ;==>_Hide_All I get a blank GUI apart from Button5. When the button is pressed I get the combo appearing and when I select one of the 3 options I get the appropriate controls with the combo vanishing again. Is that what you get and is it what you want? 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...
sliceofpie Posted September 6, 2010 Author Share Posted September 6, 2010 After selecting from the combo box, it should not go away. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 6, 2010 Moderators Share Posted September 6, 2010 sliceofpie,So remove the combo from the _Hide_All function and hide it when you first create it: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $sCurrCombo = "Option 1", $sCurrGenericData = "", $var #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 166, 298, 302, 218) $Button5 = GUICtrlCreateButton("Button5", 48, 256, 75, 25, $WS_GROUP) ; Create all controls and hide them $Combo1 = GUICtrlCreateCombo("", 8, 16, 145, 25) GUICtrlSetData(-1, "Option1|Option2|Option3", "Option 2") GUICtrlSetState(-1, $GUI_HIDE) $Button1 = GUICtrlCreateButton("Button1", 8, 56, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Button2", 8, 96, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 8, 136, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 56, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 120, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 152, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 16, 64, 121, 21) $Combo2 = GUICtrlCreateCombo("Combo2", 16, 144, 121, 25) $Button4 = GUICtrlCreateButton("Button4", 16, 104, 115, 25, $WS_GROUP) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 184, 97, 17) _Hide_All() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ShowMenu() Func ShowMenu() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button5 GUICtrlSetState($Combo1, $GUI_SHOW) EndSelect If GUICtrlRead($Combo1) <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($Combo1) = False Then ConsoleWrite(GUICtrlRead($Combo1) & @CRLF) $sCurrCombo = GUICtrlRead($Combo1) Switch $sCurrCombo Case "Option1" _Hide_All() For $i = $Button1 To $Button3 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option2" _Hide_All() For $i = $Checkbox1 To $Checkbox4 GUICtrlSetState($i, $GUI_SHOW) Next Case "Option3" _Hide_All() For $i = $Input1 To $Checkbox5 GUICtrlSetState($i, $GUI_SHOW) Next EndSwitch EndIf WEnd EndFunc ;==>ShowMenu Func _Hide_All() For $i = $Button1 To $Checkbox5 GUICtrlSetState($i, $GUI_HIDE) Next EndFunc ;==>_Hide_AllYou have enough examples now - over to you to for any further changes. 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...
sliceofpie Posted September 6, 2010 Author Share Posted September 6, 2010 Got it. Thanks for your help! I couldn't have done it without you. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 6, 2010 Moderators Share Posted September 6, 2010 sliceofpie, Glad I could help! 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...
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