Jump to content

Recommended Posts

Posted

Hi All,

I am making a GUI where, when i click a button named "Select all" , all my radio buttons should get enabled,

I have tried using:

GUISetState($r1 , $GUI_CHECKED), where $r1 is : $r1 = GUICtrlCreateRadio("Radio1", 1240, 120, 17, 17), the handle when creating radio button.

Still i am not able to acheive the enabling of radio button...

is there any other function or way to do it...

Please help me.

Posted

Yes... it is in the helpfile... :P

#include <GUIConstantsEx.au3>

Global $total = 10
Global $ahCheckboxs[10]
Global $state = 4

$hGUI = GUICreate("title", 200, 290)
For $i = 0 To $total - 1
    $ahCheckboxs[$i] = GUICtrlCreateCheckbox("Checkbox #" & $i + 1, 10, $i * 25, 150, 30)
Next

$hButton = GUICtrlCreateButton("Check All", 25, $i * 25 + 5, 150)
GUISetState()

While 1
    For $i = 0 To $total - 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case - 3
                Exit
            Case $hButton
                If $state = $GUI_UNCHECKED Then 
                    $state = $GUI_CHECKED
                Else
                    $state = $GUI_UNCHECKED
                EndIf
                For $a = 0 To $total - 1
                    GUICtrlSetState($ahCheckboxs[$a], $state)
                Next
        EndSwitch
    Next
WEnd

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
×
×
  • Create New...