serr57 Posted February 3, 2010 Share Posted February 3, 2010 Hi, I have created a GUI with check box to install our applications. Every thing works fine. I would like now add a check box, named "all applications". When I check this one, I would like that every check box in the form be automatically checked. But I don't found how to do this. Here a part of my script: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\testgui.kxf $Form1 = GUICreate("Automatic Software Installation", 633, 447, 192, 124) GUISetBkColor(0xFFFFFF) $Java = GUICtrlCreateCheckbox("Java 1.6.13", 8, 104, 130, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $Citrix = GUICtrlCreateCheckbox("Citrix", 8, 136, 130, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $Delphi = GUICtrlCreateCheckbox("Delphi 400", 8, 168, 130, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $Izarc = GUICtrlCreateCheckbox("Izarc 3.81", 8, 192, 130, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $Cancel = GUICtrlCreateButton("Cancel", 208, 360, 89, 41, $WS_GROUP) $OK = GUICtrlCreateButton("OK", 352, 360, 89, 41, $WS_GROUP) $WKS = GUICtrlCreateCheckbox("WKS Customisation", 8, 249, 130, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $Swift = GUICtrlCreateCheckbox("Swift 6.0", 8, 219, 130, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "0") $All = GUICtrlCreateCheckbox("All Applications", 304, 104, 130, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK if GUICtrlRead ($all) = $GUI_CHECKED Then GUICtrlSetState ($allapps, $GUI_CHECKED) sleep (2000) EndIf if GUICtrlRead ($java) = $GUI_CHECKED Then RunWait ("\\path\ParamToadd.exe") EndIf Exit EndSwitch WEnd If some body can help me serr57 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 3, 2010 Moderators Share Posted February 3, 2010 serr57,Welcome to the AutoIt forum. As simple way to do what you want is to see if the $All checkbox is checked during your loop and then check all the others if needed - like this:While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK If GUICtrlRead($Java) = $GUI_CHECKED Then RunWait("\\path\ParamToadd.exe") EndIf Exit EndSwitch If GUICtrlRead($All) = $GUI_CHECKED Then GUICtrlSetState($Java, $GUI_CHECKED) GUICtrlSetState($Citrix, $GUI_CHECKED) GUICtrlSetState($Delphi, $GUI_CHECKED) GUICtrlSetState($Izarc, $GUI_CHECKED) GUICtrlSetState($WKS, $GUI_CHECKED) GUICtrlSetState($Swift, $GUI_CHECKED) EndIf WEndI hope that helps. M23P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. 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...
serr57 Posted February 3, 2010 Author Share Posted February 3, 2010 serr57, Welcome to the AutoIt forum. As simple way to do what you want is to see if the $All checkbox is checked during your loop and then check all the others if needed - like this: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK If GUICtrlRead($Java) = $GUI_CHECKED Then RunWait("\\path\ParamToadd.exe") EndIf Exit EndSwitch If GUICtrlRead($All) = $GUI_CHECKED Then GUICtrlSetState($Java, $GUI_CHECKED) GUICtrlSetState($Citrix, $GUI_CHECKED) GUICtrlSetState($Delphi, $GUI_CHECKED) GUICtrlSetState($Izarc, $GUI_CHECKED) GUICtrlSetState($WKS, $GUI_CHECKED) GUICtrlSetState($Swift, $GUI_CHECKED) EndIf WEnd I hope that helps. M23 P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Many thanks, it works fine. But little question: it is not possible to script something like this : $allapps = ($swift, citrix.....)? and after : GUICtrlSetState($allapps, $GUI_CHECKED)? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 3, 2010 Moderators Share Posted February 3, 2010 (edited) serr57,Short answer = No.Longer answer = if you create all the checkboxes in IMMEDIATE succession, you can use a loop to make things a little easier:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hCheck_1 = GUICtrlCreateCheckbox("Box 1", 10, 10, 100, 20) $hCheck_2 = GUICtrlCreateCheckbox("Box 2", 10, 30, 100, 20) $hCheck_3 = GUICtrlCreateCheckbox("Box 3", 10, 50, 100, 20) $hCheck_4 = GUICtrlCreateCheckbox("Box 4", 10, 70, 100, 20) $hCheck_5 = GUICtrlCreateCheckbox("Box 5", 10, 90, 100, 20) $hCheck_6 = GUICtrlCreateCheckbox("All", 10, 200, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($hCheck_6) = $GUI_CHECKED Then For $i = $hCheck_1 To $hCheck_5 GUICtrlSetState($i, $GUI_CHECKED) Next Else For $i = $hCheck_1 To $hCheck_5 GUICtrlSetState($i, $GUI_UNCHECKED) Next EndIf WEndNow the top 5 turn on and off together when you check/uncheck the "All" box. This can be useful if you have a lot of checkboxes. M23Edit: When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Edited February 3, 2010 by Melba23 crackdonalds 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...
serr57 Posted February 3, 2010 Author Share Posted February 3, 2010 Many thanks M23, this solution seems better for me. Sorry for my post layout This case is Resolved #Resolved 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