Jump to content
Sign in to follow this  
lyledg

Reset More than one Checkbox

Recommended Posts

lyledg

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! :)

Share this post


Link to post
Share on other sites
Lazycat

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

Share this post


Link to post
Share on other sites
MHz

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. :)

Share this post


Link to post
Share on other sites
lyledg

Thanks Laztcat, you're solution was the best way forward. Also thanks to MHZ, as I am still learning the ropes ANY help and advice is taken notice of and learnt from the guru's!

Cheers matey's!!! :)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.