Jump to content

$GUI_DISABLE a group?


Recommended Posts

I have some radio buttons in a group and can enable or disable the radio buttons singularly, but I'm not able to disable the entire group. Is it even possible to disable (gray out) an entire group?

$Chk_Comps is a radio button

If GUICtrlRead($Chk_Comps) = $GUI_CHECKED Then GUICtrlSetState($Grp_Users, $GUI_DISABLE)

PS - Is anyone else having trouble with the forum search today. I can't tell if it's my network or an internal problem on the site, but it's been much slower that the quick return I'm used to.

Thanks!

Link to comment
Share on other sites

Here's one solution.

#include <GUIConstants.au3>
GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

Dim $radio[6]

$top = 10

For $a = 0 To 5
    $radio[$a] = GUICtrlCreateRadio ("Radio " & $a+1, 10, $top, 120, 20)
    $top += 20
Next

GUISetState ()      ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
    For $b = 0 To Ubound($radio) - 1
        If $msg = $radio[$b] And BitAND(GUICtrlRead($radio[$b]), $GUI_CHECKED) = $GUI_CHECKED Then _disable($B)
    Next
Wend

Func _disable($ele)
    For $i = 0 To Ubound($radio) - 1
        If $i = $ele Then
            ; skip
            Sleep(5)
        Else
            GUICtrlSetState($radio[$i], $GUI_DISABLE)
        EndIf
    Next
EndFunc

EDIT: Revised for cleaner code.

Edited by aslani

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

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