LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to modify a boolean, knowing its name and without using a local variable

Hello
I´ve got a Vi with about 100 booleans (I can´t use an array because I have to dispose them in concentric cercles) ; I would like to be able to change paremeters (Values, colors, ...) of a boolean just knowing its name, but without using local variables (for example, if user click on bollean 45, I want to change the color of bolleans 45, 46 and 47). Because It would be too complicated and too big using local variables.
Thank you in advance for your answer
Nicolas
0 Kudos
Message 1 of 6
(3,227 Views)
Hi Nicolas,

my be it helps, if you put your booleans into a clusten, that you also can
position them individual an you have access to each boolean with one
variable. If is need, you can make an attribute node for each boolean
seperatly.

Niko
Message 2 of 6
(3,227 Views)
> I´ve got a Vi with about 100 booleans (I can´t use an array because I
> have to dispose them in concentric cercles) ; I would like to be able
> to change paremeters (Values, colors, ...) of a boolean just knowing
> its name, but without using local variables (for example, if user
> click on bollean 45, I want to change the color of bolleans 45, 46 and
> 47). Because It would be too complicated and too big using local
> variables.

If you are using a recent version of LV, that has control references,
I'd do it this way.

The panel has a property called Controls[]. This gives you access to
every control on the panel. With this array of references, loop through
casting them to Boolean type, reading the name or caption, whichever you
want to compare to
, and compare to the name you are looking for. When
found, you have your reference, wire it to the property node that sets
the colors, etc.

Ideally, make all of this go in a subVI and just pass in the VI
reference, the control name, and the control colors/settings to apply.

Greg McKaskle
Message 3 of 6
(3,227 Views)
thanks for the answer : I´ll use the cluster which is the best solution. I can now change the value of a boolean, it´s ok ; However I can´t change the color of a boolean (for example boolean in position 60), without creating a property node for each one. I would like with only one tool to be able to change the color attribute of every bollean in the cluster, but I don´t know how to do it.
Thanks
Nicolas
0 Kudos
Message 4 of 6
(3,227 Views)
Hello
Thank you very much for your answer, I was able to change the status (True or False). The problem is that it seems to be not possible to change the color of the boolean with this reference.
I attach my VI with this message
thanks
Nicolas
0 Kudos
Message 5 of 6
(3,227 Views)
Hi Nico,

Cool VI!

The refnums for a cluster can have different data types. Not all data types have a color input (for example) so the refnums are cast a generic type. All of the controls in your cluster are booleans, so create a ref forone of the booleans and use it with a "To more specific" node to cast the refnum to a boolean type. You will now find the "colors" property you desire.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(3,227 Views)