Jump to content

"One box to check them all..."


Recommended Posts

Something like this ?

#include <GUIConstants.au3>

GUICreate("", 300, 180)
GUICtrlCreateLabel("Describe Helge...", 10, 10, 280, 20, $SS_CENTER)
$check1 = GUICtrlCreateCheckbox("Cool", 10, 35, 280, 20, $BS_PUSHLIKE)
$check2 = GUICtrlCreateCheckbox("Retarded", 10, 60, 280, 20, $BS_PUSHLIKE)
$check3 = GUICtrlCreateCheckbox("Strange", 10, 85, 280, 20, $BS_PUSHLIKE)
$check4 = GUICtrlCreateCheckbox("Genius", 10, 110, 280, 20, $BS_PUSHLIKE)
$checkall = GUICtrlCreateCheckbox("All", 10, 150, 280, 20, $BS_PUSHLIKE)
GUISetState()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then Exit

    If $msg = $checkall Then
        If BitAND(GUICtrlRead($checkall), $GUI_CHECKED) Then
            For $i =  $check1 To $check4
                GUICtrlSetState($i, $GUI_CHECKED)
            Next
        Else
            For $i =  $check1 To $check4
                GUICtrlSetState($i, $GUI_UNCHECKED)
            Next
        EndIf
    EndIf
WEnd

Link to comment
Share on other sites

Question 2:

Say I have a subgroup of checkboxes. If I check the "select all" box, I want ALL the boxes to be checked, but when i check the "select subgroup" box, I only want those boxes in the subgroup checked. Any way to do this?

Edit: nvm i got it

Edited by probedrone
Link to comment
Share on other sites

Its the same thing, except the checkall box would only point to the subs you want. If you look in the script where it has the variable $checkall, you will see in the while loop what happens when it is checked. just change that to point to the checkboxes you want.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...