Jump to content

How to check an autoit GUI checkbox


Recommended Posts

I have a gui that queries a database for previous selections before load. All input boxes are updating and retaining correctly. Checkbox selections are not. Here is what have tried.

When a Checkbox is checked, its GUICtrlRead is 1, if not it is 4

I am saving the value of the checkbox to a database:

$sExec = "UPDATE Users SET Eleven='" & GUICtrlRead($Checkbox1) & "' WHERE User_Name='" & $UserName & "'" ; Change a record

If _SQLite_Exec($hDB, $sExec) = $SQLITE_OK Then ConsoleWrite("Debug: Successfully updated a record." & @LF)

This is working. It is storing 1 or 4 correctly depending on if the box was checked or not.

The next time I load it should set the box to 1 or 4 from that database save, but it is actually renaming the checkbox and not checking/unchecking it

GUICtrlSetData($Checkbox1, $aRow[10])

Anyone have any idea what's going on here?

simple value test below to show 1 and 4

CODE
#include <GUIConstants.au3>

$Form1 = GUICreate("Update Profile", 780, 380)

$UpdateProfileButton = GUICtrlCreateButton("Update", 700, 350, 75, 25, 0)

$checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)

GUISetState() ; will display an dialog box with 1 checkbox

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

If $msg = $UpdateProfileButton Then

MsgBox(64, "Results", GUICtrlRead($checkCN))

EndIf

WEnd

Edited by Hatcheda
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...