Jump to content
Sign in to follow this  
Rafaelinio

How to know if checkbox is checked or not?

Recommended Posts

Rafaelinio

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?

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
Rafaelinio

I mean loopinng a message for how long the user wants to(still didnt added that option) but thanks anyways :):thumbsup:

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  

×