Jump to content

How to know if checkbox is checked or not?


Rafaelinio
 Share

Go to solution Solved by Zedna,

Recommended Posts

HI guys.

#include <GUIConstantsEx.au3>

GUI()

Func GUI()
    Local $msg, $Button1, $MsgTitle, $Message, $ChckBox1
    GUICreate("Simple Program Generator")

    Opt("GUICoordMode", 2)
    $Button1 = GUICtrlCreateButton("Create a simple message box",1,1, 402, 50)
    $ChckBox1 = GUICtrlCreateCheckbox("Loop", -400, 0, 50, 50)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button1
                $MsgTitle = InputBox("Insert Title", "Please Insert Your Message Box Title:")
                $Message = InputBox("Insert Message", "Please Insert The Message:")
                MsgBox(0, $MsgTitle, $Message)
            Case $msg = $ChckBox1
        EndSelect
    Wend
EndFunc

how do i tell if check box is checked so when i press the button it loops the message?

Link to comment
Share on other sites

  • Solution

I don't know what you mean by looping MessageBox inside GUI which is nonsense,

so here is only answer for question about reading state of chcekbox

#include <GUIConstantsEx.au3>


Global $checked
Local $msg, $Button1, $MsgTitle, $Message, $ChckBox1
GUICreate("Simple Program Generator")

Opt("GUICoordMode", 2)
$Button1 = GUICtrlCreateButton("Create a simple message box",1,1, 402, 50)
$ChckBox1 = GUICtrlCreateCheckbox("Loop", -400, 0, 50, 50)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            $MsgTitle = InputBox("Insert Title", "Please Insert Your Message Box Title:")
            $Message = InputBox("Insert Message", "Please Insert The Message:")
            $checked = BitAND(GUICtrlRead($ChckBox1), $GUI_CHECKED) = $GUI_CHECKED
            If $checked Then
                MsgBox(0, $MsgTitle & ' checked', $Message)
            Else
                MsgBox(0, $MsgTitle & ' not checked', $Message)
            EndIf
        Case $msg = $ChckBox1
    EndSelect
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...