Jump to content

SetState using string reference instead of controlID


Recommended Posts

Hello,

In my gui i have 90 checkboxes that I read and I store their value in a MySQL database. In this way I am able to save state of each checkbox.

Now I also need to be able to read what is in database stored and then check or uncheck the boxes.

 

For $iz = 3 To $iRows - 1


if $linknew11a[$iz][1] =  "True" Then 
    GUICtrlSetState($linknew11a[$iz][0], $GUI_CHECKED)
EndIf


        Next

 

$linknew11a[$iz][0] - tell me if the checkbox is True (checked) or False (Unchecked).

$linknew11a[$iz][1] - is the controlID of the checkbox (including $ sign).

The problem is that GUICtrlSetState($linknew11a[$iz][0], $GUI_CHECKED) doesnt work because instead of $linknew11a[$iz][0] which basically is the  string of controlID and I need to somehow convert this string into the real variable of the controlID.

 

Any ideas how I can do this?

If not I will need to write 90 times the if condition...

Link to comment
Share on other sites

4 minutes ago, rony2006 said:

Any ideas how I can do this?

The problem is that GUICtrlSetState($linknew11a[$iz][0], $GUI_CHECKED) doesnt work

The first parameter should be the controlID , in your case $linknew11a[$iz][1]

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

By the way : Isn't MySQL a bit too elaborate just for this case. The storage of the values for CHECKED via SQLite or very simple in an .ini or as array in a .txt file would be sufficient in my opinion.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

Just now, Musashi said:

By the way : Isn't MySQL a bit too elaborate just for this case. The storage of the values for CHECKED via SQLite or very simple in an .ini or as array in a .txt file would be sufficient in my opinion.

is true, but we use a remote MySQL database, multiple people use this software and sometimes they work on same sheet of checkboxes so there should be some sync between them.

Link to comment
Share on other sites

10 minutes ago, rony2006 said:

[3][0] is the name of checkbox and [3][1] tells me if i should set it checked or unchecked.

But in your start post it says the other way around :

23 minutes ago, rony2006 said:

$linknew11a[$iz][0] - tell me if the checkbox is True (checked) or False (Unchecked).

$linknew11a[$iz][1] - is the controlID of the checkbox (including $ sign).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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