Jump to content
Sign in to follow this  
joker17

how does check box work? how to if then else using checkbox

Recommended Posts

joker17

Also i need to create a checbox like this:

#include <GUIConstants.au3>

GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered

$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)

GUISetState ()    ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
WEnd

and it works perfect but i need to do a simple script like:

if checked then do controlsend etc, if not checked continue with the script

can someone help me?

Share this post


Link to post
Share on other sites
Nahuel

Look for GuiCtrlRead() in the help file

#include <GUIConstants.au3>

GUICreate("My GUI Checkbox",100,100) ; will create a dialog box that when displayed is centered

$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)
$Ok=GUICtrlCreateButton("OK",10,50)

GUISetState ()      ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
      Switch $msg 
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Ok
            $isChecked=GUICtrlRead($checkCN)
            If $isChecked=$GUI_CHECKED Then
                MsgBox(0,"","Hey! it's checked!")
            Else
                MsgBox(0,"","Hey! it isn't checked!")
            EndIf
        EndSwitch
WEnd

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.