MistakenSanity Posted February 25, 2011 Posted February 25, 2011 I have been trying to figure this out for some time now and haven't found much help in the forums. I have a script that uses checkboxes do complete a list of tasks. The list has grown so big that it becomes a pain to check or uncheck tons of boxes depending on what you are doing. I want to add a drop down with "profiles" you can select and depending on what profile you select a different selection of boxes will be checked. I tried using an if statement but the gui wasnt refreshing to effect the change to the drop down. Below is a modified version of the script so you can see what I am trying to do. If anyone could help or point me in the right direction I would greatly appreciate it!!!! expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Frank's Documents\Auto-It Scripts Archive\Scripts in Devlopment\Form1.kxf $Form1 = GUICreate("Window Title", 327, 530, 193, 125) ;_GUIScrollBars_Generate($Form1,0,700) $option1 = "Config 1" $option2 = "Config 2" $option3 = "Config 3" $DropDown = GuiCtrlCreateCombo($Option1, 25, 10, 280, 20) GUICtrlSetData(-1, $option2) GUICtrlSetData(-1, $option3) $Chk_Number1 = GUICtrlCreateCheckbox("Number 1", 25,30, 250, 15) $Chk_Number2 = GUICtrlCreateCheckbox("Number 2", 25,50, 250, 15) $Chk_Number3 = GUICtrlCreateCheckbox("Number 3", 25,70, 250, 15) $btnok = GUICtrlCreateButton("OK", 25, 100, 75, 25) GUISetState(@SW_SHOW) $Checked_State = False GUICtrlSetState($Chk_Number1,$GUI_CHECKED) #EndRegion ### END Koda GUI section ### ;TrayTip("Checkbox State",$STATE,1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ;Allows Close Button At Top Right Corner To Exit The Script Exit Case $btnok GuiSetState(@SW_HIDE) ;Number1 If BitAnd(GUICtrlRead($Chk_Number1),$GUI_CHECKED) = $GUI_CHECKED THEN; ElseIf BitAnd(GUICtrlRead($Chk_Number1),$GUI_UNCHECKED) = $GUI_UNCHECKED THEN; EndIf ;Number2 If BitAnd(GUICtrlRead($Chk_Number2),$GUI_CHECKED) = $GUI_CHECKED THEN; ElseIf BitAnd(GUICtrlRead($Chk_Number2),$GUI_UNCHECKED) = $GUI_UNCHECKED THEN; EndIf ;Number3 If BitAnd(GUICtrlRead($Chk_Number3),$GUI_CHECKED) = $GUI_CHECKED THEN; ElseIf BitAnd(GUICtrlRead($Chk_Number3),$GUI_UNCHECKED) = $GUI_UNCHECKED THEN; EndIf Exit EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
Moderators Melba23 Posted February 25, 2011 Moderators Posted February 25, 2011 MistakenSanity, You should have mentioned you were using one of my UDFs! This will give you the basic idea of how to link the combo to the checkboxes: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> $Form1 = GUICreate("Window Title", 327, 530, 193, 125) $option1 = "Config 1" $option2 = "Config 2" $option3 = "Config 3" $DropDown = GUICtrlCreateCombo("", 25, 10, 280, 20) GUICtrlSetData(-1, "Config 1|Config 2|Config 3") $Chk_Number1 = GUICtrlCreateCheckbox("Number 1", 25, 100, 250, 15) $Chk_Number2 = GUICtrlCreateCheckbox("Number 2", 25, 120, 250, 15) $Chk_Number3 = GUICtrlCreateCheckbox("Number 3", 25, 140, 250, 15) $btnok = GUICtrlCreateButton("OK", 25, 180, 75, 25) GUISetState(@SW_SHOW) $Checked_State = False GUICtrlSetState($Chk_Number1, $GUI_CHECKED) $sCurrCombo = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnok EndSwitch $sCombo = GUICtrlRead($DropDown) If $sCurrCombo <> $sCombo And _GUICtrlComboBox_GetDroppedState($DropDown) = False Then $sCurrCombo = $sCombo Switch $sCombo Case "Config 1" GUICtrlSetState($Chk_Number1, $GUI_CHECKED) GUICtrlSetState($Chk_Number2, $GUI_UNCHECKED) GUICtrlSetState($Chk_Number3, $GUI_UNCHECKED) Case "Config 2" GUICtrlSetState($Chk_Number1, $GUI_UNCHECKED) GUICtrlSetState($Chk_Number2, $GUI_CHECKED) GUICtrlSetState($Chk_Number3, $GUI_UNCHECKED) Case "Config 3" GUICtrlSetState($Chk_Number1, $GUI_UNCHECKED) GUICtrlSetState($Chk_Number2, $GUI_UNCHECKED) GUICtrlSetState($Chk_Number3, $GUI_CHECKED) EndSwitch EndIf WEnd Please 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
MistakenSanity Posted February 27, 2011 Author Posted February 27, 2011 Thank you so much for your help!!! Sorry for the PM :-). This is almost how I was trying to do it, but i was a bit off it appears. Thanks!!!!
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