LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GUI: variable width/height of array elements

Solved!
Go to solution

It would be very useful for dashboard- or list-type GUIs which use mixed controls (i.e. array of clusters) to adjust the width/height on a per-element basis. Here is a mockup of what I'm talking about:

 

array.png

 

In this case it's a vertical dashboard where each element should have a minimum height and increase the height depending on the size of the list indicator (either manually or programmatically). I know it shouldn't be possible because GUI sizes are properties and properties must be identical for all array elements - so I either have to limit the list height and use the scroll bar if there are more elements than the shown ones (which leads to ugly artefacts on all other array elements), or make the height fit to the largest list and waste vertical space in all other array elements.

 

I know you can get the reference of each individual element or sub-control (e.g. to distinguish which array element the user clicked on) and change its value without writing data to the array, but changing its properties applies to all array elements. There are some workarounds e.g. to fake per-element background colors using a color box, but I'm not aware of a front panel indicator that changes its size via its value (and whether that would even affect the array cell size).

 

So apart from the "it's impossible" comments, is there a way to at least approximate what I want to do or a completely different smarter way to do it? I don't think I can use anything other than an array though because I need to display mixed controls.

0 Kudos
Message 1 of 5
(703 Views)

You can get the look you want using a cluster of about 30 clusters.  When you set this from your data array of clusters, just hide the extra clusters you don't need.  30 is more than enough to fill the screen, and if you need a scrolling you can fake that using an independent scroll bar.

 

With a cluster of clusters you can customize every element individually.

0 Kudos
Message 2 of 5
(692 Views)

You mean using a cluster of a pre-defined size (max. expected elements in the dashboard) instead of an array? That sounds intriguing and a (very large) hard limit for the number of elements should be acceptable for most applications. I assume I'd have to programmatically reposition all visible ("active") cluster elements relative to the parent cluster if one of them has to change size, right? It's tedious (especially implementing scrolling) but should be doable. I'll try that, thanks!

0 Kudos
Message 3 of 5
(681 Views)
Solution
Accepted by Novgorod

Make the outer cluster autosize vertically; no manual positioning needed.  The scroll bar isn't that hard, and with it your "array" can have millions of elements, just limited to how many can be displayed at one time (which is limited by screen size anyway).

 

To be clear, your actual data is still an array; only the UI display element is a cluster of clusters.

Message 4 of 5
(671 Views)
Solution
Accepted by Novgorod

Oh, I see, "AutoSizing -> Align Vertically" does the magic. I thought if it's not set to "Size to Fit", the bounding box of the outer cluster would stay constant, but that's not the case, it resizes automatically. That makes it very easy and even the scrollbar should be simple if you don't have to care about the positioning. Thanks, that's perfect!

0 Kudos
Message 5 of 5
(636 Views)