07-11-2014 12:29 PM
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
Solved! Go to Solution.
07-11-2014 12:50 PM
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.
07-11-2014 01:03 PM
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!
07-11-2014 01:16 PM
@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
07-11-2014 01:22 PM
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.
07-11-2014 01:41 PM
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.
07-11-2014 01:48 PM - edited 07-11-2014 02:03 PM
@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!