12-19-2014 03:00 AM - last edited on 10-20-2024 11:59 AM by Content Cleaner
Hello all,
I have an array of cluster that is shaped as a line with different display elements.
A list or a tree wouldn't have made it, so I had to use a cluster and make a table.
The problem is that I want to change not only the text but also the text color.
Individually.
I found this :
But it change the property in all the clusters in the array, not just the one I need.
Some people have the same problem :
http://forums.ni.com/t5/LabVIEW/Reference-to-Array-of-Clusters-with-an-array-element/td-p/1006427
http://forums.ni.com/t5/LabVIEW/array-of-clusters-get-references-to-all-the-clusters/td-p/1079456
http://forums.ni.com/t5/LabVIEW/Writing-only-to-certain-cluster-elements-in-an-array-by/m-p/2200728
http://forums.ni.com/t5/LabVIEW/Update-Properties-Of-One-Control-In-An-Array/m-p/3015501
Obviously, while in a list/table or tree you can change the property of an individual
cell (font, color) you cannot do it within an array of cluster, by some sort of magic,
the property of a cluster element (font, color) are all linked together, hence rendering
the use of an array worthless.
A possible hack is proprosed by using control masking, setting one visible and the
other invisble, swapping their position, whatever. It's a hack you have to perform,
hence add another code to maintain.
Is that still the case or is there now a more official way to handle individual cluster
properties, not just its data ? After all that's a common real-life example that should
be handled by Labview. In my opinion.
David Koch
Solved! Go to Solution.
12-19-2014 06:58 AM
Every element in an array has the exact same properties. It doesn't matter if the data is a cluster. The reason is the way the array is rendered. It is the same control/indicator duplicated with a different value.
What is all of the data in your cluster? You may be able to get away with a Table, which will allow you to do what you want on a cell basis.
12-19-2014 08:13 AM
Hello, thanks for the feedback.
Basically, each line mirror a database table. The important point :
In red, enums automatically set and displaying the right value
In blue, the test result I want to change the font color, line per line
I don't see why the property of a string cannot be set on an individual
basis. OK to say that at this location there is a string indicator, now
I'd like to change the color. Currently it's set to black, either is pass
or fail. I just wanted to use normative colours such as green vs. red.
David Koch
12-19-2014 08:59 AM
I'd say the easiest solution is to add a color box behind the text and color the "background" that way. It's not quite what you asked for, but a workaround.
A very cumbersome solution is to remove the array and place free controls and access them through some smart function. You'd also need to implement a free scrollbar which'd fill the controls through some offset and such ...
/Y
12-19-2014 09:04 AM
Something along this line:
/Y
12-19-2014 09:10 AM
I'll never ever get out of this, thanks anyway for the kind offer, but no.
I would have accepted this in Labview 2 or 3. Not in 2013 or 2014.
David Koch
12-19-2014 01:18 PM - last edited on 10-20-2024 12:00 PM by Content Cleaner
What about an XControl? The datatype could be a cluster with the string and text color info and the display could be just a string.
OK, just looked into that a bit and it looks like that won't work.
Here's the request to make something like that work
https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Array-of-XControls/idi-p/1107173
12-19-2014 01:40 PM
One of the elements could be a 2D picture indicator of about the same size. You can write text in any color using picture functions.
12-19-2014 01:58 PM
in THEORY (have never tried it) you could use an active X Object created from (and Linked to) an excel spreadsheet letting Excell handle some of the formating since those tables can have enumerated pulldowns or even pictures.
12-19-2014 02:08 PM - edited 12-19-2014 02:09 PM
@altenbach wrote:
One of the elements could be a 2D picture indicator of about the same size. You can write text in any color using picture functions.
Here's what I had in mind. Seems to work just fine (I would fine-tune the font, picture border, etc. but this should get you started).