Timppa Posted December 15, 2015 Share Posted December 15, 2015 Hello again!I couldn't think any clearer title for this topic so I explain my problem:What I want is a three different ComboBoxes. There is 3 names in it: Bob, Jane and Fred. Then there is a priority list like this:1st priority: > ComboBox 2nd priority: > ComboBox 3rd priority: > ComboBoxIf I select Jane as first priority, it will DISAPPEAR from other combo boxes as well, since I cannot use Jane for first and second priority.You get the idea? And the default combo box is "Not set", if I set the "Not set" from Jane, the Jane item will appear again in the other ComboBoxes. Also, if you press Confirm button and there is one "Not set" visible, it will show a message that you need to set priority. This is simple and I guess I can do on my own but need help to "hide" the already selected name.Is this possible? I totally have no idea how to do this so I do not have any script for that. Thanks in advance! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2015 Moderators Share Posted December 15, 2015 @Timppa I would suggest you start with building your GUI. Below is a framework to get you started; look in the help file under GUICtrlCreateCombo to create your combo boxes. Once you have your own script written, even if it is not doing exactly what you want, post here and we will do our best to assist.#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 300, 300) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 15, 2015 Moderators Share Posted December 15, 2015 Timppa,I got involved in updating combos depending on what had already been selected in this thread - take a look and see if it helps. Please ask if you have any questions about how I went about 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...
Timppa Posted December 16, 2015 Author Share Posted December 16, 2015 @Timppa I would suggest you start with building your GUI. Below is a framework to get you started; look in the help file under GUICtrlCreateCombo to create your combo boxes. Once you have your own script written, even if it is not doing exactly what you want, post here and we will do our best to assist.#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 300, 300) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd JLogan, I have the GUI already, this section is another form from the main GUI. This form opens when I press "Advanced Options" button and the GUI has been made alredy, there is nothing particular script that would affect the priority script I would like to have. But thanks anyways! Timppa,I got involved in updating combos depending on what had already been selected in this thread - take a look and see if it helps. Please ask if you have any questions about how I went about it.M23Allright I checked that thread and it was quite hard to understand because the OP asked kind of different thing (well practically the same thing, but in more advanced way(or complicated )).So far he wanted action for 7 different days, so that would be same for me but 3 different priorities.So would it start with this, right?Global $ComboArray[][] = [["Jane"],["Bob"],["Fred"]]But I'm not sure which part of script "hides" the already selected items because that script is in my opinion too complicated. Would this be it?For $j = 1 + $k To 2 + $k $aChoreList[$j] = StringReplace($aChoreList[$j], "|" & $aChores[$i][0] & "|", "|") Next(That was copy pasted from the other topic) Thanks in advance! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 16, 2015 Moderators Share Posted December 16, 2015 Timppa,that script is in my opinion too complicatedReally? Here is a simple version for the case you describe, although it can be expanded to as many combos as you wish:expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GuiComboBox.au3> ; Array to hold combo ControlIDs Global $aCombo[4] = [3] ; Array to hold combo data - only full list set for first combo, note leading | Global $aData[4] = [3, "|Bob|Jane|Fred"] $hGUI = GUICreate("Test", 500, 500) ; Create combos - set as read-only For $i = 1 To $aCombo[0] $aCombo[$i] = GUICtrlCreateCombo("", (150 * $i) - 140, 10, 100, 20, $CBS_DROPDOWNLIST) ; Set a cuebanner to display if no selection made _GUICtrlComboBox_SetCueBanner($aCombo[$i], "Not set") Next ; Load first combo with all data GUICtrlSetData($aCombo[1], $aData[1]) ; Create button to check if all combos set $cCheck = GUICtrlCreateButton("Check", 10, 100, 80, 30) GUICtrlSetState($cCheck, $GUI_FOCUS) GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cCheck ; Set check flag $bCheck = True ; Loop through combos For $i = 1 To $aCombo[0] ; Get selection - if CueBanner displayed then no selection returned If GUICtrlRead($aCombo[$i]) = "" Then ; Clear flag $bCheck = False ; No point in checking further ExitLoop EndIf Next If $bCheck Then ; No empty combos MsgBox($MB_SYSTEMMODAL, "Correct", "All priorities set") Else ; At least one enpty combo MsgBox($MB_SYSTEMMODAL, "Error", "Please set all priorities") EndIf Case Else ; Must be a combo For $i = 1 To $aCombo[0] - 1 ; No need to do anything when final combo actioned If $iMsg = $aCombo[$i] Then ; Read combo selection $sSel = GUICtrlRead($aCombo[$i]) ; Take current combo selection with trailing "|", remove the selected item and then remove the trailing "|" ; This is required in case one element is a subset of another $aData[$i + 1] = StringTrimRight(StringReplace($aData[$i] & "|", "|" & $sSel & "|", "|"), 1) ; Set the shortened data in the next combo GUICtrlSetData($aCombo[$i + 1], $aData[$i + 1]) ; Empty all remaining combos For $j = $i + 2 To $aCombo[0] - 1 GUICtrlSetData($aCombo[$j], "") Next ; No point in looping further ExitLoop EndIf Next EndSwitch WEndIs that clearer?M23 Timppa 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...
Timppa Posted December 16, 2015 Author Share Posted December 16, 2015 Ohh yes. That is more simplier version. I guess I got confused because there were so much more lines of script that I do not need and got totally confused but that script is in fact very easy to understand.Thank you very much for the help! Also, I always try my best to build up my own scripts, but sometimes I run out of ideas since this language is so new to me 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