LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change enum colour in a cluster that is in an array

Solved!
Go to solution

Hi,

 

So I have this cluster with a string and an enum, that is in an array. I am using a producer/consumer event design pattern, so on the event of a mouse clicking a specific row another VI pops up with a pass/fail button and comment string.

 

After playing around with 'CtlRef' in the event structure I found the 'ArrElem.Value' property node that lets me find the specific array element clicked on. I can then unbundle and bundle that specific cluster. Based on the enum value of pass/fail I'd like the colours green/red respectively.

 

My question, how do I find the reference of a specific enum inside a cluster to change its colour based on text? I have been able to reference the cluster only. 

 

Thanks.

 

FYI, I'm using LV 2010 SP1

0 Kudos
Message 1 of 7
(3,926 Views)

Won't work with an enum inside and definately not inside of an array.  One way around it would be to use a Boolean instead.  Just set the Boolean text to "Pass" and "Fail" and make the Boolean text visible.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(3,913 Views)

Ah, that is what I originally had but complicated it with an enum. I was hoping to get 3 states, not checked/pass/fail.

 

I'll have to put some sort of detection in to make sure all elements were at least clicked on, because the common fail/not checked boolean state.

 

Thanks for putting my mind at ease!

0 Kudos
Message 3 of 7
(3,905 Views)

@bwhinch wrote:

My question, how do I find the reference of a specific enum inside a cluster to change its colour based on text?


From a reference of a Cluster you can get the an array of references of the controls that make up the cluster.

If you change any "property" (color, font etc) of items (controls) in an array, you change to property for the entire array.

Items in an array can only have different values.

 

So as stated earlier, you can't have different properties of color of your enum that are contained in an array.

 

But as suggested the value of a Boolean (Pass/Fail) with different colors for the true/false states might work

Or add a color box behind your enum to the cluster. Set the enum back ground to transparent and then set the value of the color box to effect a color change of your enum

Omar
Message 4 of 7
(3,894 Views)
Solution
Accepted by topic author bwhinch

You have a bit of a problem here.

 

Your cluster is in an array.  only values can change between array elements all other properties must be the same.

 

So, what you need is a colorbox in the cluster.  (Ah Briliant!)  place it behind the other elements and make the other controls background color Transparent. 


"Should be" isn't "Is" -Jay
Message 5 of 7
(3,889 Views)

What about a picture ring?  Rings have a lot of similarities to enums.  Each item of the ring could be a string of text on top of a colored background.

Message 6 of 7
(3,879 Views)

@JÞB wrote:

 

So, what you need is a colorbox in the cluster.  (Ah Briliant!)  place it behind the other elements and make the other controls background color Transparent. 


That is an interesting idea, I never thought to include a colour box. I'll try that out, thanks!
Edit: Turned out that was really simple compared with what I was originally trying to do, worked like a charm!

 

Message 7 of 7
(3,872 Views)