LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modificar programáticamente el caption de los elementos de un array de controles boolean con los elementos de un array de strings

Solved!
Go to solution

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.

 

control_programatico.png

aladegar_0-1658143459636.png

aladegar_1-1658143487381.png

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.

0 Kudos
Message 1 of 21
(1,197 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 21
(1,188 Views)

Hi GerdW good morning,

 

Thanks you a lot, I hadn't thought of that possibility.

 

I will try it and report back.

 

Regards, 

Aladegar.

0 Kudos
Message 3 of 21
(1,147 Views)

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.

 

aladegar_0-1658212966333.png

array_of_clusters_of_boolean_controls.png

0 Kudos
Message 4 of 21
(1,139 Views)

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:

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 21
(1,135 Views)

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.

0 Kudos
Message 6 of 21
(1,107 Views)
Solution
Accepted by topic author aladegar

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 21
(1,103 Views)

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.

0 Kudos
Message 8 of 21
(1,097 Views)

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!

0 Kudos
Message 9 of 21
(1,061 Views)
Solution
Accepted by topic author aladegar

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 21
(1,054 Views)