Jump to content

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


joker17
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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