Sign in to follow this  
Followers 0
Hein88

Radioboxes and CTRL states.

8 posts in this topic

#1 ·  Posted (edited)

Hello,

I've been trying to get this working but I didnt succeed.

The idea:

1. look if any radiogroups are disabled, and if they're disabled skip them

2. look if non of the left radioboxes are checked (without the disabled)

3. disable some GUI_ctrl's when non of the enabled radioboxes are checked left or right.

3. enable some GUI_ctrl's when one of the enabled radioboxes are checked left or right.

1.Posted Image2.Posted Image3.Posted Image

Situation1 would enable the controls related to the left column and right column as well.

Situation2 would disable the controls related to the left column. Since there are no enabled radioboxes checked in the left column.

Situation3 would enable controls related to the left column and the right colum aswell.

MY SCRIPT:

I am working with message loop.

My radioboxes:

$radio1_left
$radio1_right = GUICtrlCreateRadio ("XP CD1", 255, 270, )
$radio2_left = ..
$radio2_right = ..
$radio3_left = ..
$radio3_right = ..
$radio4_left
$radio4_right

My current script for the SKIP_checkboxes: $check1, $check2, $check3 and $check4

Case GUICtrlRead ( $check1 ) = $GUI_CHECKED and GUICtrlGetState ( <other control> ) = '80' 
                    GUICtrlSetState <other controls>

                    GUICtrlSetState ( $radio1_left, $GUI_DISABLE )
                    GUICtrlSetState ( $radio1_right, $GUI_DISABLE )

        Case GUICtrlRead ( $check1 ) = $GUI_UNCHECKED and GUICtrlGetState ( <other control> ) = '144' 
                    GUICtrlSetState <other controls>

                    GUICtrlSetState ( $radio1_left, $GUI_ENABLE )
                    GUICtrlSetState ( $radio1_right, $GUI_ENABLE )
oÝ÷ Ø̶צ¦×è®Ø^­§b¡º1zÇ(uè¢w«iبneyûb±È^rGÜ"W§i¹^¶«zV­y×(ÚèÆ®¶­sd66RuT7G&Å&VBb33c·&FóöÆVgBÒb33c´uTô4T4´TB÷"uT7G&Å&VBb33c·&Fó%öÆVgBÒb33c´uTô4T4´TB÷"uT7G&Å&VBb33c·&Fó5öÆVgBÒb33c´uTô4T4´TB÷"uT7G&Å&VBb33c·&FóEöÆVgBÒb33c´uTô4T4´T@ uT7G&Å6WE7FFRfÇC¶÷FW"6öçG&öÇ2fwC²fÇC´Tä$ÄTBfwCoÝ÷ Ú'碶èÆW¶+ç$yØ­Â)ev+nW­êÞ«^uÊ'¶º%²È­¹«b¢}ºÚ"µÍ][ÝÛÈYXI][Ý

I hope that my problem is a bit understandable :whistle: and I also hope someone has a solution...

Edited by Hein88

Share this post


Link to post
Share on other sites



Without a small replication script, you won't find much help. In the help file you will see that it uses BitAnd() to check the states. v3.2 does at least. Then you can move on.

Here is 1 or 2 links that may help:

http://www.autoitscript.com/forum/index.ph...55&hl=Radio

http://www.autoitscript.com/forum/index.ph...amp;hl=checkbox


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thnx,

I created a replication script now..

#include <GUIConstants.au3>
$Form1 = GUICreate("Radios", 391, 400, 192, 125)
;radios
    GUICtrlCreateGroup("XP CD CPU Structures", 220, 235, 150, 125)
    GUICtrlCreateLabel ( "x64", 260, 255, )
    GUICtrlCreateLabel ( "x86", 230, 255, )
    GUIStartGroup()
    $radio1x64 = GUICtrlCreateRadio ("XP CD1", 255, 270, )
    $radio1 = GUICtrlCreateRadio ("--", 230, 270, )
    GUICtrlSetState (-1, $GUI_CHECKED)
    GUIStartGroup()
    $radio2x64 = GUICtrlCreateRadio ("XP CD2", 255, 290, )
    $radio2 = GUICtrlCreateRadio ("--", 230, 290, )
    GUICtrlSetState (-1, $GUI_CHECKED)
;checkboxes 
    $check1 = GUICtrlCreateCheckbox ( "Skip", 315, 268 )
    $check2 = GUICtrlCreateCheckbox ( "Skip", 315, 288 )


    $Button1 = GUICtrlCreateButton("Exit", 128, 148, 121, 33)
    $buttonXp1 = GUICtrlCreateButton("XP1", 355, 130, 30, 20)
    $buttonXp2 = GUICtrlCreateButton("XP2", 355, 155, 30, 20)
    $buttonX86 = GUICtrlCreateButton("X86", 355, 50, 30, 20)
    $buttonX64 = GUICtrlCreateButton("x64", 355, 70, 30, 20)
       
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case $msg = $check1
        If BitAnd (GuiCtrlRead ($check1), $GUI_CHECKED) then
           GUICtrlSetState ( $buttonxp1, $GUI_DISABLE )
           GUICtrlSetState ( $radio1, $GUI_DISABLE )
            GUICtrlSetState ( $radio1x64, $GUI_DISABLE )
        Endif
        If BitAnd (GuiCtrlRead ($check1), $GUI_UNCHECKED) then
           GUICtrlSetState ( $buttonxp1, $GUI_ENABLE )
           GUICtrlSetState ( $radio1, $GUI_ENABLE )
            GUICtrlSetState ( $radio1x64, $GUI_ENABLE )
        Endif
    Case $msg = $check2
        If BitAnd (GuiCtrlRead ($check2), $GUI_CHECKED) then
           GUICtrlSetState ( $buttonxp2, $GUI_DISABLE )
           GUICtrlSetState ( $radio2, $GUI_DISABLE )
            GUICtrlSetState ( $radio2x64, $GUI_DISABLE )
        Endif
        If BitAnd (GuiCtrlRead ($check2), $GUI_UNCHECKED) then
           GUICtrlSetState ( $buttonxp2, $GUI_ENABLE )
           GUICtrlSetState ( $radio2, $GUI_ENABLE )
            GUICtrlSetState ( $radio2x64, $GUI_ENABLE )
        Endif
    EndSelect
WEnd
Exit

If both skip checkboxes are checked > should be button x86 and x64 not available

If there is no radiobox available (or disabled or not checked) in column x64 > button x64 should be disabled

If there is no radiobox available in column x86 > button x86 should be disabled

Is this enough info?

Edited by Hein88

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

a working example (that starts up) would be great :whistle:

Edit:

You have to read the state of "both" check boxes with a case or if statement, and if both of them are checked then disable, you don't read both, only one at a time in your example, and only on click... so $msg = click1 then I'm going to check the state of click2 and if both are checked, then I will disable buttons... You don't read the state of both. It's going to get bigger, that's why I use arrays when I make things like this, code stays nice and neat.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

If both skip checkboxes are checked > should be button x86 and x64 not available

this piece of code is doing that now :whistle:

Case GUICtrlRead ($check1) = $GUI_CHECKED and GUICtrlRead ($check2) = $GUI_CHECKED and GUICtrlGetState ( $buttonX86 ) = '80' 
            GUICtrlSetState ( $buttonX64, $GUI_DISABLE )
            GUICtrlSetState ( $buttonX86, $GUI_DISABLE )
    Case GUICtrlRead ($check1) <> $GUI_CHECKED or GUICtrlRead ($check2) <> $GUI_CHECKED and GUICtrlGetState ( $buttonX86 ) = '144' 
            GUICtrlSetState ( $buttonX64, $GUI_ENABLE )
            GUICtrlSetState ( $buttonX86, $GUI_ENABLE )

However still 2 cases to go...

If there is no radiobox available (or disabled or not checked) in column x64 > button x64 should be disabled

If there is no radiobox available in column x86 > button x86 should be disabled

for example

Column x64:

Radiobox 1 = disabled

Radiobox 2 = unchecked

> button x64 should be disabled

Share this post


Link to post
Share on other sites

Working script:

For people who might want to use it idontknowwho.

#include <GUIConstants.au3>
$Form1 = GUICreate("Radios", 391, 400, 192, 125)
;radios
    GUICtrlCreateGroup("XP CD CPU Structures", 220, 235, 150, 125)
    GUICtrlCreateLabel ( "x64", 260, 255, )
    GUICtrlCreateLabel ( "x86", 230, 255, )
    GUIStartGroup()
    $radio1x64 = GUICtrlCreateRadio ("XP CD1", 255, 270, )
    $radio1 = GUICtrlCreateRadio ("--", 230, 270, )
    GUICtrlSetState (-1, $GUI_CHECKED)
    GUIStartGroup()
    $radio2x64 = GUICtrlCreateRadio ("XP CD2", 255, 290, )
    $radio2 = GUICtrlCreateRadio ("--", 230, 290, )
    GUICtrlSetState (-1, $GUI_CHECKED)
    GUIStartGroup()
    $radio3x64 = GUICtrlCreateRadio ("XP CD3", 255, 310, )
    $radio3 = GUICtrlCreateRadio ("--", 230, 310, )
    GUICtrlSetState (-1, $GUI_CHECKED)
;checkboxes 
    $check1 = GUICtrlCreateCheckbox ( "Skip", 315, 268 )
    $check2 = GUICtrlCreateCheckbox ( "Skip", 315, 288 )
    $check3 = GUICtrlCreateCheckbox ( "Skip", 315, 308 )


    $Button1 = GUICtrlCreateButton("Exit", 128, 148, 121, 33)
    $buttonXp1 = GUICtrlCreateButton("XP1", 355, 130, 30, 20)
    $buttonXp2 = GUICtrlCreateButton("XP2", 355, 155, 30, 20)
    $buttonXp3 = GUICtrlCreateButton("XP3", 355, 180, 30, 20)
    $buttonX86 = GUICtrlCreateButton("X86", 355, 50, 30, 20)
    $buttonX64 = GUICtrlCreateButton("x64", 355, 70, 30, 20)
       
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case $msg = $check1
        If BitAnd (GuiCtrlRead ($check1), $GUI_CHECKED) then
           GUICtrlSetState ( $buttonxp1, $GUI_DISABLE )
           GUICtrlSetState ( $radio1, $GUI_UNCHECKED )
            GUICtrlSetState ( $radio1x64, $GUI_UNCHECKED )
           GUICtrlSetState ( $radio1, $GUI_DISABLE )
            GUICtrlSetState ( $radio1x64, $GUI_DISABLE )
        Endif
        If BitAnd (GuiCtrlRead ($check1), $GUI_UNCHECKED) then
           GUICtrlSetState ( $buttonxp1, $GUI_ENABLE )
           GUICtrlSetState ( $radio1, $GUI_ENABLE )
           GUICtrlSetState ( $radio1, $GUI_CHECKED )
            GUICtrlSetState ( $radio1x64, $GUI_ENABLE )
        Endif
    Case $msg = $check2
        If BitAnd (GuiCtrlRead ($check2), $GUI_CHECKED) then
           GUICtrlSetState ( $buttonxp2, $GUI_DISABLE )
           GUICtrlSetState ( $radio2, $GUI_UNCHECKED )
           GUICtrlSetState ( $radio2, $GUI_DISABLE )
           GUICtrlSetState ( $radio2, $GUI_UNCHECKED )
            GUICtrlSetState ( $radio2x64, $GUI_DISABLE )
        Endif
        If BitAnd (GuiCtrlRead ($check2), $GUI_UNCHECKED) then
           GUICtrlSetState ( $buttonxp2, $GUI_ENABLE )
           GUICtrlSetState ( $radio2, $GUI_ENABLE )
           GUICtrlSetState ( $radio2, $GUI_CHECKED )
           GUICtrlSetState ( $radio2x64, $GUI_ENABLE )
        Endif 
    Case $msg = $check3
        If BitAnd (GuiCtrlRead ($check3), $GUI_CHECKED) then
           GUICtrlSetState ( $buttonxp3, $GUI_DISABLE )
           GUICtrlSetState ( $radio3, $GUI_UNCHECKED )
           GUICtrlSetState ( $radio3, $GUI_DISABLE )
            GUICtrlSetState ( $radio3x64, $GUI_UNCHECKED )
            GUICtrlSetState ( $radio3x64, $GUI_DISABLE )            
        Endif
        If BitAnd (GuiCtrlRead ($check3), $GUI_UNCHECKED) then
           GUICtrlSetState ( $buttonxp3, $GUI_ENABLE )
           GUICtrlSetState ( $radio3, $GUI_ENABLE )
           GUICtrlSetState ( $radio3, $GUI_CHECKED )
           GUICtrlSetState ( $radio3x64, $GUI_ENABLE )
        Endif 

    Case GUICtrlRead ($radio1) = $GUI_CHECKED or GUICtrlRead ($radio2) = $GUI_CHECKED or GUICtrlRead ($radio3) = $GUI_CHECKED and GUICtrlGetState ( $buttonX86 ) = '144' 
            GUICtrlSetState ( $buttonX86, $GUI_ENABLE )
            
    Case GUICtrlRead ($radio1) = $GUI_UNCHECKED and GUICtrlRead ($radio2) = $GUI_UNCHECKED and GUICtrlRead ($radio3) = $GUI_UNCHECKED and GUICtrlGetState ( $buttonX86 ) = '80' 
            GUICtrlSetState ( $buttonX86, $GUI_DISABLE )

    Case GUICtrlRead ($radio1x64) = $GUI_CHECKED or GUICtrlRead ($radio2x64) = $GUI_CHECKED or GUICtrlRead ($radio3x64) = $GUI_CHECKED and GUICtrlGetState ( $buttonX64 ) = '144' 
            GUICtrlSetState ( $buttonX64, $GUI_ENABLE )
            
    Case GUICtrlRead ($radio1x64) = $GUI_UNCHECKED and GUICtrlRead ($radio2x64) = $GUI_UNCHECKED and GUICtrlRead ($radio3x64) = $GUI_UNCHECKED and GUICtrlGetState ( $buttonX64 ) = '80' 
            GUICtrlSetState ( $buttonX64, $GUI_DISABLE )
            
    Case GUICtrlRead ($check1) = $GUI_CHECKED and GUICtrlRead ($check2) = $GUI_CHECKED and GUICtrlRead ($check3) = $GUI_CHECKED and GUICtrlGetState ( $buttonX86 ) = '80'
            GUICtrlSetState ( $buttonX64, $GUI_DISABLE )
            GUICtrlSetState ( $buttonX86, $GUI_DISABLE )
    Case GUICtrlRead ($check1) = $GUI_UNCHECKED or GUICtrlRead ($check2) = $GUI_UNCHECKED or GUICtrlRead ($check3) = $GUI_UNCHECKED and GUICtrlGetState ( $buttonX86 ) = '144' and GUICtrlGetState ( $buttonX64 ) = '144'
            GUICtrlSetState ( $buttonX64, $GUI_ENABLE ) 
            GUICtrlSetState ( $buttonX86, $GUI_ENABLE )
        
        
    EndSelect
WEnd
Exit

AutoIT Rocks :whistle:

Share this post


Link to post
Share on other sites

Me

i love to try new things and collect code

who knows it may come in handy some day :whistle:


Share this post


Link to post
Share on other sites

Keep in mind this is probably not the most efficient code for the target However its works, I believe :whistle:

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