Jump to content
Sign in to follow this  
sharrakor

How do I store whether or not a box is checked in my GUI?

Recommended Posts

sharrakor

I made a gui for my program that saves values to an ini file. I was wondering though, how can I make it so that the next time the user starts the program and brings up the gui, the correct values are checked? What kind of variable would I use and how would I go about doing it?

Share this post


Link to post
Share on other sites
Pain

Save the value with GUICtrlRead($checkbox).

Use this when you create your GUI (startup).

$checkbox = GUICtrlCreateCheckbox("My checkbox", 40, 200, 250, 20)

GUICtrlSetState(-1, IniRead("file.ini", "Check", "Checkbox1", 4))

A checkbox can have two values, 1 or 4 depending on if it's selected or not.

1 = checked

4 = unchecked

Edited by Pain

Share this post


Link to post
Share on other sites
sharrakor

Thanks. Exactly what I needed to know.

I'm assuming the same thing would apply for a dropdown list (guictrlsetdata)? Except with the value I want?

Share this post


Link to post
Share on other sites
sharrakor

So how do I read the value (1 or 4)? If I see what the value of the box is equal to, it just gives me the control ID.

Sorry for the basic question.

Share this post


Link to post
Share on other sites
Pain

IniWrite("file.ini", "Checkbox", "Checkbox1", GUICtrlRead($checkbox))

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.