Jump to content
Sign in to follow this  
qixx

CheckBox - Need Help

Recommended Posts

qixx

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!

Share this post


Link to post
Share on other sites
Phaser

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

Share this post


Link to post
Share on other sites
somdcomputerguy

Use this way to check..

If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Phaser

Use this way to check..

If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then

Hi Bruce

I tried that way yesterday and didnt get any result, the way I posted above does work as I thought it would, your way seemd to NOT work for me?

Share this post


Link to post
Share on other sites
somdcomputerguy

@Phaser - I copied and pasted that line right out of one of my working scripts. I don't know why it wouldn't be working for you..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
somdcomputerguy

Looks right to me.. And if it does work, it probably is right.. >_


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Genos

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

Share this post


Link to post
Share on other sites
qixx

Thanks @ all!

It works. :(

>_<

MfG

qixx

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  

×