07-18-2022 06:26 AM
Buenos días,
Estoy desarrollando un programa que tiene que presentar un array de controles booleanos. Cada elemento de este array tiene que controlar el estado ON/OFF de una variable en formato string.
Quiero hacer esta modificación de manera programática, es decir, sin tener que introducir a mano cada string en el caption de cada control booleano.
Como fuente tengo un array de strings.
Como se puede ver en las imágenes, el primer array contiene unas strings y quiero que esas strings sean los caption de los controles booleanos.
No obstante, solo consigo que salga el último.
Disculpad si hay cosas que no tienen sentido o están mal programadas pero estoy haciendo pruebas, investigando y aprendiendo funcionalidades nuevas.
Gracias y un saludo.
Solved! Go to Solution.
07-18-2022 07:11 AM
Hi aladegar,
simple rule: in an array all elements share the same properties!
When you want to show different strings next to your booleans you should use an array of clusters[boolean, string]. Then you can change the string for each boolean…
07-19-2022 12:24 AM
Hi GerdW good morning,
Thanks you a lot, I hadn't thought of that possibility.
I will try it and report back.
Regards,
Aladegar.
07-19-2022 01:46 AM
Hello again GerdW,
I have tried what you have suggested but I have not been successful.
If you could send me an example with an array of boolean clusters it would be of great help.
This is one of my unsuccessful attempts, because it only shows me the last string of the array as the caption of the boolean control.
07-19-2022 06:25 AM - edited 07-19-2022 06:26 AM
Hi aladegar,
@aladegar wrote:
I have tried what you have suggested but I have not been successful.
I told you to use an array of clusters, but you again used a plain string array…
See this example:
07-22-2022 04:21 AM
Thank you very much GerdW,
I have implemented the array of clusters and I get more or less what I want, but I still have the same problem.
I need the booleans of the clusters to be controls, nor indicators, and the string I need to ber assigned to the Label and Caption of each boolean control.
I have tried several options but I need it to be programmatic, I can't let the user write the Label and/or caption values of the boolean controls every time they run the program.
Regards,
Aladegar.
07-22-2022 04:29 AM
Hi aladegar,
@aladegar wrote:
I need the booleans of the clusters to be controls, nor indicators, and the string I need to ber assigned to the Label and Caption of each boolean control.
Set the whole array as a control, so the booleans (and the strings) become controls too.
Then right-click the string and set advanced->ActiveState->Deactivated. Now the user cannot edit that string anymore, it acts like an indicator.
Set the strings as needed instead of the boolean label/caption…
07-22-2022 05:10 AM
Achieved!
Thank you GerdW, the last part was perhaps the simplest but at the last minute I was alredy burned. I have managed to bind the captions of the controls individually and programatically.
Thanks for the help and patience.
Best Regards,
Aladegar.
07-26-2022 02:52 AM
Hi GerdW,
If the vector that gives me the boolean controls inside the cluster is dynamic because it comes from a for loop, would it be possible to set the values of the strings to be copied into the label value of each boolean control iterated through the loop?
Thank you!
07-26-2022 03:18 AM
Hi aladegar,
@aladegar wrote:
If the vector that gives me the boolean controls inside the cluster is dynamic because it comes from a for loop, would it be possible to set the values of the strings to be copied into the label value of each boolean control iterated through the loop?
Yes.
See my example from message #5: it doesn't matter if the boolean values are generated within the loop or are provided from some other source?