Sign in to follow this  
Followers 0
slightly_abnormal

radio buttons, how?

8 posts in this topic

Hi.. how do i get the groups to have a radio button $MAIN that is check and then the child radios can be checked only the main radio button stays check until I go to the other group, and the other main radio is check, ect.

#include <GUIConstants.au3>

$Form1 = GUICreate("Radios", 391, 294, 192, 125)
$Group1 = GUICtrlCreateGroup("This", 8, 16, 377, 89)
$Main1 = GUICtrlCreateRadio("One", 40, 48, 97, 17,$BS_AUTORADIOBUTTON)
$main1_rad1= GUICtrlCreateRadio("These", 272, 56, 81, 17)
$main1_rad2= GUICtrlCreateRadio("These", 272, 40, 81, 17)
$main1_rad3= GUICtrlCreateRadio("These", 272, 72, 81, 17)
$main1_rad4 = GUICtrlCreateCheckbox("Check", 176, 72, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("That", 8, 136, 377, 89)
$Main2 = GUICtrlCreateRadio("One", 40, 176, 105, 17,$BS_AUTORADIOBUTTON)
$main2_rad1 = GUICtrlCreateRadio("These", 264, 160, 81, 17)
$main2_rad2= GUICtrlCreateRadio("These", 264, 176, 81, 17)
$main2_rad3 = GUICtrlCreateRadio("These", 264, 192, 81, 17)
$main2_rad4 = GUICtrlCreateCheckbox("Check", 176, 192, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button1 = GUICtrlCreateButton("Exit", 128, 248, 121, 33)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1 
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



Hi.. how do i get the groups to have a radio button $MAIN that is check and then the child radios can be checked only the main radio button stays check until I go to the other group, and the other main radio is check, ect.

Maybe its just me, but I don't understand what you are tring to do.

Share this post


Link to post
Share on other sites

Maybe its just me, but I don't understand what you are tring to do.

No its not just you


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Just a shot in the dark... but do you mean that the other group is disabled (cannot be checked) until you check something on the first (Main) group?


Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

does the picture make sence?

Posted Image

[eidt] yeah, thats what i mean... nomad..

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

Do you mean this?

#include <GUIConstants.au3>

$Form1 = GUICreate("Radios", 391, 294, 192, 125)
$Group1 = GUICtrlCreateGroup("This", 8, 16, 377, 89)
$Main1 = GUICtrlCreateRadio("One", 40, 48, 97, 17,$BS_AUTORADIOBUTTON)
$Main2 = GUICtrlCreateRadio("One", 40, 176, 105, 17,$BS_AUTORADIOBUTTON)
GUICtrlCreateGroup("", -99, -99, 1, 1)


$main1_rad1= GUICtrlCreateRadio("These", 272, 56, 81, 17)
$main1_rad2= GUICtrlCreateRadio("These", 272, 40, 81, 17)
$main1_rad3= GUICtrlCreateRadio("These", 272, 72, 81, 17)
$main1_rad4 = GUICtrlCreateCheckbox("Check", 176, 72, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

;$Group2 = GUICtrlCreateGroup("That", 8, 136, 377, 89)


$main2_rad1 = GUICtrlCreateRadio("These", 264, 160, 81, 17)
$main2_rad2= GUICtrlCreateRadio("These", 264, 176, 81, 17)
$main2_rad3 = GUICtrlCreateRadio("These", 264, 192, 81, 17)
$main2_rad4 = GUICtrlCreateCheckbox("Check", 176, 192, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button1 = GUICtrlCreateButton("Exit", 128, 248, 121, 33)
GUICtrlSetState ( $Main1_rad1, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad2, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad3, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad4, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad1, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad2, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad3, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad4, $GUI_DISABLE )
        
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1 
        ExitLoop
    Case $msg = $main1
        If BitOr (GuiCtrlRead ($main1), $GUI_CHECKED) then
        
        GUICtrlSetState ( $Main1_rad1, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad2, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad3, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad4, $GUI_ENABLE )
        
        GUICtrlSetState ( $Main2_rad1, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad2, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad3, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad4, $GUI_DISABLE )
        Endif
    Case $msg = $main2
        If Bitor (GuiCtrlRead ($main2), $GUI_CHECKED) then
        
        GUICtrlSetState ( $Main2_rad1, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad2, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad3, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad4, $GUI_ENABLE )
        
        GUICtrlSetState ( $Main1_rad1, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad2, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad3, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad4, $GUI_DISABLE )
        Endif
        
        
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

Yes.. thanks!

Share this post


Link to post
Share on other sites

I think it should have been BitAnd not BitOr,

Also did you want it to remove the check if one was previously selected?

#include <GUIConstants.au3>

$Form1 = GUICreate("Radios", 391, 294, 192, 125)
$Group1 = GUICtrlCreateGroup("This", 8, 16, 377, 89)
$Main1 = GUICtrlCreateRadio("One", 40, 48, 97, 17,$BS_AUTORADIOBUTTON)
$Main2 = GUICtrlCreateRadio("One", 40, 176, 105, 17,$BS_AUTORADIOBUTTON)
GUICtrlCreateGroup("", -99, -99, 1, 1)


$main1_rad1= GUICtrlCreateRadio("These", 272, 56, 81, 17)
$main1_rad2= GUICtrlCreateRadio("These", 272, 40, 81, 17)
$main1_rad3= GUICtrlCreateRadio("These", 272, 72, 81, 17)
$main1_rad4 = GUICtrlCreateCheckbox("Check", 176, 72, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

;$Group2 = GUICtrlCreateGroup("That", 8, 136, 377, 89)


$main2_rad1 = GUICtrlCreateRadio("These", 264, 160, 81, 17)
$main2_rad2= GUICtrlCreateRadio("These", 264, 176, 81, 17)
$main2_rad3 = GUICtrlCreateRadio("These", 264, 192, 81, 17)
$main2_rad4 = GUICtrlCreateCheckbox("Check", 176, 192, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button1 = GUICtrlCreateButton("Exit", 128, 248, 121, 33)
GUICtrlSetState ( $Main1_rad1, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad2, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad3, $GUI_DISABLE )
GUICtrlSetState ( $Main1_rad4, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad1, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad2, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad3, $GUI_DISABLE )
GUICtrlSetState ( $Main2_rad4, $GUI_DISABLE )
        
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1 
        ExitLoop
    Case $msg = $main1
        If BitAnd (GuiCtrlRead ($main1), $GUI_CHECKED) then
        
        GUICtrlSetState ( $Main1_rad1, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad2, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad3, $GUI_ENABLE )
        GUICtrlSetState ( $Main1_rad4, $GUI_ENABLE )
        
        GUICtrlSetState ( $Main2_rad1, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad1, $GUI_UNCHECKED)
        GUICtrlSetState ( $Main2_rad2, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad2, $GUI_UNCHECKED)
        GUICtrlSetState ( $Main2_rad3, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad3, $GUI_UNCHECKED)
        GUICtrlSetState ( $Main2_rad4, $GUI_DISABLE )
        GUICtrlSetState ( $Main2_rad4, $GUI_UNCHECKED)
        Endif
    Case $msg = $main2
        If BitAnd (GuiCtrlRead ($main2), $GUI_CHECKED) then
        
        GUICtrlSetState ( $Main2_rad1, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad2, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad3, $GUI_ENABLE )
        GUICtrlSetState ( $Main2_rad4, $GUI_ENABLE )
        
        GUICtrlSetState ( $Main1_rad1, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad1, $GUI_UNCHECKED )
        GUICtrlSetState ( $Main1_rad2, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad2, $GUI_UNCHECKED )
        GUICtrlSetState ( $Main1_rad3, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad3, $GUI_UNCHECKED )
        GUICtrlSetState ( $Main1_rad4, $GUI_DISABLE )
        GUICtrlSetState ( $Main1_rad4, $GUI_UNCHECKED )
        Endif
        
        
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

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  
Followers 0