Jump to content
Sign in to follow this  
monitorlg

Enabling Radio Button

Recommended Posts

monitorlg

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.

Share this post


Link to post
Share on other sites
BrettF
monitorlg

Radio button means 1 at a time to me. I think you want a checkbox?

How to enable all the check boxes...do u have any idea...

Share this post


Link to post
Share on other sites
BrettF

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

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  

×