Jump to content

Read Checkboxes


Rawox
 Share

Recommended Posts

Hi,

Does anyone knows how to read Checkboxes??

I tried this:

Case $msg = $GenerateButton
If GUICtrlRead ( $Small, $GUI_CHECKED ) Then
MsgBox ( 0, "Succes", "Succes" )
Else
MsgBox ( 0, "Error", "Error" )
EndIf

This is my list with Variables:

$GenerateButton = GUICtrlCreateButton ( "Generate", 305, 170, 85, 22 )
            $QuitButton = GUICtrlCreateButton ( "Quit", 270, 205, 120, 25 )
            $MoreIncludesButton = GUICtrlCreateButton ( "More Includes", 10, 205, 120, 25 )
            $MoreNumbersButton = GUICtrlCreateButton ( "More Numbers", 140, 205, 120, 25 )
            $Small = GUICtrlCreateCheckbox ( "Small Characters", 30, 48, 110, 20 )
            $Capital = GUICtrlCreateCheckbox ( "Capital Characters", 30, 65, 110, 20 )
            $Number = GUICtrlCreateCheckbox ( "Numbers (0-9)", 200, 48, 110, 20 )
            $Special = GUICtrlCreateCheckbox ( "Special Symbols", 200, 65, 110, 20 )
            $Char1 = GUICtrlCreateRadio ( "1", 30, 118, 40, 20 )
            $Char2 = GUICtrlCreateRadio ( "2", 100, 118, 40, 20 )
            $Char3 = GUICtrlCreateRadio ( "3", 170, 118, 40, 20 )
            $Char4 = GUICtrlCreateRadio ( "4", 240, 118, 40, 20 )
            $Char5 = GUICtrlCreateRadio ( "5", 310, 118, 40, 20 )
            $Char6 = GUICtrlCreateRadio ( "6", 30, 135, 40, 20 )
            $Char7 = GUICtrlCreateRadio ( "7", 100, 135, 40, 20 )
            $Char8 = GUICtrlCreateRadio ( "8", 170, 135, 40, 20 )
            $Char9 = GUICtrlCreateRadio ( "9", 240, 135, 40, 20 )
            $Char10 = GUICtrlCreateRadio ( "10", 310, 135, 40, 20 )

It needs to read the checkbox, if it's checked it needs to return the succes message box if the checkbox is unchecked it needs to return the error message box...

Anyone??

Link to comment
Share on other sites

If BitAnd(GuiCtrlRead($Small), $GUI_Checked) Then
    MsgBox(0, "Results", "Checked")
Else
    MsgBox(0, "Results", "UnChecked")
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If BitAnd(GuiCtrlRead($Small), $GUI_Checked) Then
    MsgBox(0, "Results", "Checked")
Else
    MsgBox(0, "Results", "UnChecked")
EndIf
Is it also possible to check for multiple checked checkboxes??
Link to comment
Share on other sites

Is it also possible to check for multiple checked checkboxes??

If my multiple you mean several then yes. Just put it in a loop.

$cbx_1 = GUICtrlCreateCheckbox("Number 1", 10, 10, 60, 20)
$cbx_2 = GUICtrlCreateCheckbox("Number 2",10, 25, 60, 20)
$cbx_3 = GUICtrlCreateCheckbox("Number 3",10, 40, 60, 20)
$cbx_4 = GUICtrlCreateCheckbox("Number 4",10, 55, 60, 20)
$cbx_5 = GUICtrlCreateCheckbox("Number 5",10, 70, 60, 20)

For $i = $cbx_1 To $cbx_5
If BitAnd(GuiCtrlRead($i), $GUI_Checked) Then
    MsgBox(0, "Results", "Checked")
Else
    MsgBox(0, "Results", "UnChecked")
EndIf
Next

Edit: Fixed positioning error in code

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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