MacScript Posted July 10, 2014 Share Posted July 10, 2014 Is there a way to dynamically change a value in a drop down box. For instance the drop down box has the following options to select Setup Mode-Dual Copy Filter When the person selects the Option -> Mode-Dual <- Event handle does a few things but also changes the list to look like -> Setup Mode-Single Copy Filter Then if the person would choose Mode-Single it would then change back to Mode-Dual. I have looked over the forums and internet and have not found anything that helps me accomplish this. Any pointers would be appreciated (Don't really want to do a control destroy and create it again if I can avoid that). Thanks Link to comment Share on other sites More sharing options...
JohnOne Posted July 10, 2014 Share Posted July 10, 2014 GuiCtrlSetData AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MacScript Posted July 10, 2014 Author Share Posted July 10, 2014 Thanks Johnone That is only a part of it. Need to take the entire contents of the dropdown box. Do a string replace Then Empty the contents of the control Then add the data back into the control Sample code below: _GUICtrlComboBox_ResetContent($cmbMainOpt) $tmpMainMenuOpt = StringReplace($tmpMainMenuOpt, "Mode-Dual", "Mode-Single") GUICtrlSetData($cmbMainOpt, $tmpMainMenuOpt) Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted July 10, 2014 Moderators Solution Share Posted July 10, 2014 MacScript,You are overcomplicating things - using GUICtrlSetData with a leading "|" will replace the data automatically: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $sData_Dual = "|Setup|Mode-Dual|Copy|Filter" ; Note leading "|" $sData_Single = "|Setup|Mode-Single|Copy|Filter" $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, $sData_Dual) $fDual = True ; Set a flag GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo Switch GUICtrlRead($cCombo) Case "Setup" MsgBox($MB_SYSTEMMODAL, "Selected", "Setup") Case "Copy" MsgBox($MB_SYSTEMMODAL, "Selected", "Copy") Case "Filter" MsgBox($MB_SYSTEMMODAL, "Selected", "Filter") Case Else $fDual = Not $fDual ; Toggle the flag If $fDual Then GUICtrlSetData($cCombo, $sData_Dual) Else GUICtrlSetData($cCombo, $sData_Single) EndIf EndSwitch EndSwitch WEndM23 pixelsearch 1 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...
MacScript Posted July 10, 2014 Author Share Posted July 10, 2014 Thanks for the information about using the "|". However I still will do the string replace cause I suspect this dropdown in the future will have other options to swap in and out. Thanks again 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