Jump to content

CheckBox Problems


Recommended Posts

When the checkbox is checked and I hit save it suppose to msgbox, help is appreciated.

Current Code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$frmSettings = GUICreate("Settings", 128, 152, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$Group1 = GUICtrlCreateGroup("Main", 8, 0, 113, 113, -1, $WS_EX_TRANSPARENT)
$cbReload = GUICtrlCreateCheckbox("Reload On Save", 16, 24, 113, 17)
$Label1 = GUICtrlCreateLabel("X Location:", 16, 56, 58, 17)
$Label2 = GUICtrlCreateLabel("Y Location:", 16, 80, 58, 17)
$xLoc = GUICtrlCreateInput("0", 80, 54, 30, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
$yLoc = GUICtrlCreateInput("0", 80, 78, 30, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btnSave = GUICtrlCreateButton("Save", 8, 120, 113, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnSave
            If $cbReload = $GUI_CHECKED Then
                MsgBox(0, "Alert!", "You Checked The Box!")
            EndIf

    EndSwitch
WEnd
Edited by Godly
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$frmSettings = GUICreate("Settings", 128, 152, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
$Group1 = GUICtrlCreateGroup("Main", 8, 0, 113, 113, -1, $WS_EX_TRANSPARENT)
$cbReload = GUICtrlCreateCheckbox("Reload On Save", 16, 24, 113, 17)
$Label1 = GUICtrlCreateLabel("X Location:", 16, 56, 58, 17)
$Label2 = GUICtrlCreateLabel("Y Location:", 16, 80, 58, 17)
$xLoc = GUICtrlCreateInput("0", 80, 54, 30, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
$yLoc = GUICtrlCreateInput("0", 80, 78, 30, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btnSave = GUICtrlCreateButton("Save", 8, 120, 113, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnSave
            If _IsChecked($cbReload) Then
                MsgBox(0, "Alert!", "You Checked The Box!")
            EndIf

    EndSwitch
WEnd

Func _IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

8)

NEWHeader1.png

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