06-08-2020 07:18 AM
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.
Solved! Go to Solution.
06-08-2020 07:41 AM
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.
06-08-2020 07:47 AM
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.
06-08-2020 08:30 AM
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?
06-08-2020 09:14 AM
@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.
06-08-2020 08:06 PM
Hi Ravens,
Got it. That’s great help for me. Thank you.