rony2006 Posted March 8, 2021 Posted March 8, 2021 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...
Musashi Posted March 8, 2021 Posted March 8, 2021 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] "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
rony2006 Posted March 8, 2021 Author Posted March 8, 2021 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.
Musashi Posted March 8, 2021 Posted March 8, 2021 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. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
rony2006 Posted March 8, 2021 Author Posted March 8, 2021 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.
Danp2 Posted March 8, 2021 Posted March 8, 2021 You should be able to use Execute() to do this -- GUICtrlSetState(Execute($linknew11a[$iz][0]), $GUI_CHECKED) Latest Webdriver UDF Release Webdriver Wiki FAQs
rony2006 Posted March 8, 2021 Author Posted March 8, 2021 4 minutes ago, Danp2 said: You should be able to use Execute() to do this -- GUICtrlSetState(Execute($linknew11a[$iz][0]), $GUI_CHECKED) Thanks a lot. you saved me at least 1 hour.
Musashi Posted March 8, 2021 Posted March 8, 2021 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). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
rony2006 Posted March 8, 2021 Author Posted March 8, 2021 Just now, Musashi said: But in your start post it says the other way around : Yes, you are right. Sorry. But anyway I didnt knew until now that i need to put "execute". Thanks!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now