Jump to content

Reset More than one Checkbox


lyledg
 Share

Recommended Posts

Guys..

Thanx for all your help thus far, you have all helped me tremendously..

I do however have one more question:

I have about 10 checkboxes...What I am trying to do is create a Reset button which will uncheck all of them simultaneously, if they are indeed checked.

How would I go about this Please?

Cheers! :)

Link to comment
Share on other sites

You should uncheck each checkbox in your function. But you can simplicity this process, if you create array of control ID's at create time. Something like (pseudocode):

#include <GUIConstants.au3>
Global $check_array[10]
GUICreate("GUI")
$check_array[0] = GUICtrlCreateCheckbox(...)
$check_array[1] = GUICtrlCreateCheckbox(...)
...
$check_array[9] = GUICtrlCreateCheckbox(...)


Func Reset()
    Local $i
    For $i = 0 To 9
        GUICtrlSetState($check_array[$i], $GUI_UNCHECKED)
    Next
EndFunc
Edited by Lazycat
Link to comment
Share on other sites

Something different to Lazycat's method.

This is out of one of my select case functions (trimmed), inside a loop

Case $msg = $chk_301
         If GUIRead($chk_301) = $GUI_CHECKED Then
            GUICtrlSetState($inp_303, $GUI_ENABLE)
            GUICtrlSetState($inp_305, $GUI_ENABLE)
            GUICtrlSetState($timezone, $GUI_ENABLE)
            GUICtrlSetState($inp_320, $GUI_ENABLE)
            GUICtrlSetState($inp_316, $GUI_ENABLE)
            GUICtrlSetState($inp_318, $GUI_ENABLE)
            GUICtrlSetState($refresh, $GUI_ENABLE)
         Else
            GUICtrlSetState($inp_303, $GUI_DISABLE)
            GUICtrlSetState($inp_305, $GUI_DISABLE)
            GUICtrlSetState($timezone, $GUI_DISABLE)
            GUICtrlSetState($inp_320, $GUI_DISABLE)
            GUICtrlSetState($inp_316, $GUI_DISABLE)
            GUICtrlSetState($inp_318, $GUI_DISABLE)
            GUICtrlSetState($refresh, $GUI_DISABLE)
         EndIf
Now, If I check $chk_301 then all the all states of other controls change, ELSE they change the other way. Select case, look in the guide. Worthy reading, inside a While Wend loop, is handy. :)
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...