Jump to content

check boxes [SOLVED]


BryonR
 Share

Recommended Posts

I'm trying for something like

$result= GuiCtrlRead ($checkBox),$GUI_CHECKED then "checked" else "uncheck"

MsgBox(48, "test", $result, 3)

Check boxes are far from my stong point, any help would be welcomed.

-Bryon

Edited by BryonR
Link to comment
Share on other sites

Thank you...

#include <GUIConstants.au3>

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

$menu1  = GUICtrlCreateMenu("File")

$n1  = GUICtrlCreateCheckbox("Alpha", 10, 10,80)
$n2  = GUICtrlCreateButton("Read", 10, 100, 50)
GUICtrlSetState(-1, $GUI_FOCUS); the focus is on this button

GUISetState (); will display an empty dialog box
; Run the GUI until the dialog is closed
Do
    $msg = GUIGetMsg()
    if $msg = $n2 Then
        $n1state = GUICtrlRead($n1); return the state of $n1
        If $n1state = $GUI_CHECKED  Then MsgBox(4096,"",GUICtrlRead($n1,1) & " is checked")
        If $n1state = $GUI_UNCHECKED  Then MsgBox(4096,"",GUICtrlRead($n1,1) & " is unchecked")
    EndIf
Until $msg = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

#include <GUIConstants.au3>

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

$menu1 = GUICtrlCreateMenu("File")

$n1 = GUICtrlCreateCheckbox("Alpha", 10, 10, 80)
$n2 = GUICtrlCreateButton("Read", 10, 100, 50)
GUICtrlSetState(-1, $GUI_FOCUS); the focus is on this button

GUISetState(); will display an empty dialog box
; Run the GUI until the dialog is closed
Do
    $msg = GUIGetMsg()
    If $msg = $n2 Then
        If _IsChecked($n1) Then
            MsgBox(4096, "", GUICtrlRead($n1, 1) & " is checked")
            ; FileWrite($File, "checked")
        Else
            MsgBox(4096, "", GUICtrlRead($n1, 1) & " is unchecked")
            ; FileWrite($File, "unchecked")
        EndIf
    EndIf
Until $msg = $GUI_EVENT_CLOSE

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

8)

Edited by Valuater

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