LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change properties of a cluster element withing an array of clusters

Solved!
Go to solution

Kochise,

I haven't been able to follow your "best practices" line, so can't comment.   But I played around with a Cluster of clusters and I think you can do what you want with it.  Use the "Controls[]" property to aquire an array of references to your set of clusters, and "Controls[]" again to get a 2D array of references to all subcontrols.   Then you can easily index out a reference to a specific string, say, and set any property you want (you'll need to cast the control ref to a string type).  Easier than other possibilities.

0 Kudos
Message 31 of 35
(1,358 Views)

You mean, something like that ?

 

Clipboard01.png

 

Tried without much luck, hence I disabled it.

 

This one works instead :

 

https://forums.ni.com/t5/LabVIEW/Change-properties-of-a-cluster-element-withing-an-array-of/m-p/3072...

 

David Koch

0 Kudos
Message 32 of 35
(1,355 Views)

You need to start with a Cluster or clusters (so each contained cluster is a separate control with separate attributes), rather than an Array of clusters (where there is only one contained cluster control for all elements).   Like this:

 

Working with Cluster of subClusters by Reference.png

This way has the advantage of allowing all attributes to be set, for any kind of control.

 

Added later: using references like this also allows one to dynamically register on the individual controls, allowing LOTS of fancy UI work.

0 Kudos
Message 33 of 35
(1,344 Views)

0 Kudos
Message 34 of 35
(1,341 Views)

@Kochise wrote:
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.


In an attempt to get this somewhat back on topic, let me suggest another alternative (although I realize you've already gone with Altenbach's clever picture control solution): separate the outputs (the measurements and results) from the inputs (the rings, etc) for display purposes only. Place a table indicator next to the array of clusters. With a little effort, you should be able to make it all line up nicely, so it looks like it's on the same line. You may need to use the classic controls and make the borders transparent - looks like you've already figured out some of those tricks. Display the results in the table. That way you get individual control over the display of each cell, with minimal changes to your existing interface. You can of course keep the results in the existing cluster as well, if it helps you group the data, and just don't show those elements of the cluster.

 


@David-A wrote:

I'm a little late to the party here but nathand put together an excellent example a while back that demonstrates the table idea that hoovah mentioned. Its got a slick interface, and like hoovah pointed out you can modify the color of the text since its a table control not an array.

 

https://forums.ni.com/t5/Example-Code/Click-to-Edit-Table-Using-an-Array-of-Clusters/ta-p/3508160


Thanks for sharing this more widely! Possibly also worth noting that this approach also handles keyboard navigation cleanly, although I think changes in event handling between LabVIEW 2012 and 2013 broke that portion of the code.

0 Kudos
Message 35 of 35
(1,316 Views)