Jump to content

Setting the state of a checkbox...


ARozanski
 Share

Recommended Posts

I have created a GUI that saves certain settings...such as wether a checkbox is checked or not...it saves the data to an .ini file - so if the checkbox is checked =1 if unchecked =0...how do i get the checkbox to be checked when i run the GUI if the data in the .ini is already = 1...

thank you in advance...

Link to comment
Share on other sites

I have created a GUI that saves certain settings...such as wether a checkbox is checked or not...it saves the data to an .ini file - so if the checkbox is checked =1 if unchecked =0...how do i get the checkbox to be checked when i run the GUI if the data in the .ini is already = 1...

thank you in advance...

you can do something like:

#include <GuiConstantsEx.au3>

GUICreate("")
GUISetState(@sw_show)
$box = GUICtrlCreateCheckbox("Test",10,10)

$ini = IniRead("File.ini","default", 1, -1)

If $ini = 1 Then
    GUICtrlSetState($box, $GUI_CHECKED)
ElseIf $ini = 0 Then
    GUICtrlSetState($box, $GUI_UNCHECKED)
EndIf

While 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf   
WEnd

good luck with the rest

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