Jump to content

Recommended Posts

Posted

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

Posted
  On 3/8/2021 at 6:53 PM, rony2006 said:

Any ideas how I can do this?

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

Expand  

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

Posted

No because the array is 0 based.

Look at the pic.

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

 

iDzlpwE.png

Posted

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

Posted
  On 3/8/2021 at 7:06 PM, 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.

Expand  

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.

Posted
  On 3/8/2021 at 7:06 PM, rony2006 said:

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

Expand  

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

  On 3/8/2021 at 6:53 PM, 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).

Expand  

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

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