Jump to content

CheckBox - Need Help


qixx
 Share

Recommended Posts

Hi,

I don't understand how I

could use a Checkbox.

If the Checkbox is true,

$var2 should be:

$var2=1

If the CheckBox ist false,

$var2 schould be:

$var2=0

$CheckBox1 = GUICtrlCreateCheckbox ( "Check", 170, 90)

Sry for my english, but

I'm german.>_<

Thank you!

Link to comment
Share on other sites

I was doing this yesterday and found this

if BitAnd(GUICtrlRead($checkbox), $GUI_CHECKED) = True Then
ExitLoop
EndIf

The exitloop bit is obviousley for my script, put what you need in there

HTH

Edited by Phaser
Link to comment
Share on other sites

I copy/pasted that, and it works for me.

#include <GUIConstantsEx.au3>


GUICreate("My GUI Button") 
$check = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)
$Button_1 = GUICtrlCreateButton("Display Value", 10, 30, 100)
GUISetState()      

While 1
        $msg = GUIGetMsg()
        
    if $msg = $Button_1 then POPUP()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


Func POPUP()

If GUICtrlRead($check) = $GUI_CHECKED Then     
    $var2=1     
Else     
    $var2=0 
Endif
    msgbox(0,"Yep",$var2)
EndFunc

that's just slopped together, but if you click the button with the box unchecked, you will get 0, with it checked you will get 1

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