LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the Boolean color in cluster?

Solved!
Go to solution

Hi 

 

I creat a cluster and put a boolean control in it. I want to change the boolean’s color with property. Three colors I need to change such as red, blue and green. How can I do this? Tried several times but failed.

0 Kudos
Message 1 of 6
(3,129 Views)
Solution
Accepted by topic author Jim_Liu

Use the Controls[] property node on the cluster. This will return an array of references to the cluster elements. Use Index Array on the references to get the reference to the control you want to change. This reference is of control type so you need to typecast it to a boolean control (using To More Specific Class function) to be able to access the property and method nodes specific to boolean controls.

LucianM_1-1591620049520.png

 

Lucian
CLA
0 Kudos
Message 2 of 6
(3,112 Views)

The problem with that solution is that it assumes the boolean is at index 0 within the cluster.  If it isn't, then you need to figure out which is your boolean of interest (loop through all controls and find the one that matches the name?).

 

You can change the properties much more easily.

From your front panel, select the boolean within the cluster.  Right click and pick Create Property Node.

Now you'll have a property mode linked specifically to that control within the cluster on your block diagram.

0 Kudos
Message 3 of 6
(3,106 Views)

Hi LucianM,

 

Thank you. This works now. I choose Decos[] to edit the color first, because Controls[] doesn't contain Colors[4] option. And i don't know why i need a class to do this.

Now it is clear for me. 

Also i have another question. Why this doesn't work if i change the cluster to Strict custom type ctl?

0 Kudos
Message 4 of 6
(3,078 Views)

@Jim_Liu wrote:

 

Also i have another question. Why this doesn't work if i change the cluster to Strict custom type ctl?


Strict type def controls means not only is the type of the control defined, but all of the graphical appearance stuff associated with it is also defined.  So you can't change the color of something that has been locked by it being a STRICT type definition.

0 Kudos
Message 5 of 6
(3,058 Views)

Hi Ravens,

 

Got it. That’s great help for me. Thank you.

0 Kudos
Message 6 of 6
(3,017 Views)