Jump to content

Recommended Posts

Posted

hiho

I have searched and searched but i cant find any help.

maybe you are able to help me

my problem is that ... i want to use checkboxes and i want to check if they are activated or not

if i use GuiCtrlRead($Checkbox) ill get only the Controlid from the box

if i use GuiCtrlgetState($Checkbox) ill only get an 80 dont know what it is for.

but whether they are checked or not i get only the same value but i need to work with

TRUE or FALSE ... 0 or 1 something that let me decide.

plz help guys

Posted

hi,

hope that helps you

#include <GUIConstants.au3>

GUICreate ("CheckState", 120, 60)

$check = GUICtrlCreateCheckbox ("My Checkbox", 10, 10, 100, 20)

$but = GUICtrlCreateButton ("Get State", 10, 30, 100, 20)

GuiSetState()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then

ExitLoop

ElseIf $msg = $but Then

$state = GuiCtrlRead ($check)

If $state = 1 Then

$state_text = "Checked"

Else ;unchecked=4

$state_text = "Unchecked"

EndIf

MsgBox (0,"State", $state_text)

EndIf

Wend

greets, chris

Posted

hiho

I have searched and searched but i cant find any help.

maybe you are able to help me

my problem is that ... i want to use checkboxes and i want to check if they are activated or not

if i use GuiCtrlRead($Checkbox) ill get only the Controlid from the box

if i use GuiCtrlgetState($Checkbox) ill only get an 80 dont know what it is for.

but whether they are checked or not i get only the same value but i need to work with

TRUE or FALSE ... 0 or 1 something that let me decide.

plz help guys

GuiCtrlRead($Checkbox) return the state so you can test it with $GUI_CHECKED. remember you can have several state so the correct checking must be done with BitAnd(GuiCtrlRead($Checkbox), $GUI_CHECKED)

GuiCtrlgetState($Checkbox) as stated in the doc

As opposed to GUICtrlRead this function returns only the state of a control (disabled/hidden/etc)

Guest Jakub Hadraba
Posted

Hi, here's another example with GUIEvent mode, shall you prefer this one.

We get the state of the checkbox and display it in the label below it.

Jakub (see att.)

chkbox.au3

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...