LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage with complex interfaces


@Sam_Sharp wrote:

Yes, that is possible - but if I were you I would be more inclined to go down the subpanel route.

 

Clusters are best used as structured data types and not for UI elements - for example, if you register for a value change event, you can only register for it on the whole cluster, which means you need to then work out which item inside the cluster has changed and it just gets messy.

 


Just how messy does it get?  It's actually not too bad!  I created a "Demo" Mixed Metaphor Front Panel as an array of three "Kitchen Sink" Clusters, and found it was pretty easy to figure out which Array Element and which Cluster Element were changed.  Here's (a picture of) the Front Panel (a Snippet will follow, but if you don't have LabVIEW 2016, it's simple enough to re-create "by hand").

Front Panel Choice.png

Now here's the Event Structure (I haven't put it in a While loop, as this is just for Demo purposes)(I also initialize it with a Local Variable as a Quick and Dirty Shortcut, again just for this Demo).

Front Panel Choice BD.pngThe code to the left just builds an array of three of these Front Panel Clusters.  When you change an element of one of the clusters, you (a) change only a single Array element, and (b) change only a single Cluster element in that array.  So inside the Value Change Event, you can do an element-by-element compare of the Old and New value.  The For Loop looks for any Array element that has a Cluster element showing inequality (guaranteed to be exactly one), and outputs both the Array index and a Boolean array corresponding to the Cluster elements.  The second For Loop returns the index of the differing Cluster element.

 

The Front Panel shows what happened when I put "John" in the Subject Name field (Cluster Index 2) of the second Array element (Array Index 1).

 

Bob Schor

Message 11 of 14
(702 Views)

@Bob_Schor wrote:

@Sam_Sharp wrote:

... 


Just how messy does it get?  It's actually not too bad!  

...

Bob Schor


Ok - that's a nice little demo...but...let's say you want to change the 'start' to a 'stop' button once it has been pressed and also to disable the top row of controls so that the user can't change them while the channel is running? What about if the system rejects 'John' as a subject name and you need to change it back to something else? These are all typical things that you might want to do to make the user interface intuitive and doing these sorts of operations on clusters/arrays of clusters can be a challenge (if not impossible - e.g. you can't set one element of an array of clusters to have different properties to the other elements).

 

In your example - If I wanted to have that sort of functionality I would have 3 subpanels each containing a reentrant UI 'channel entry' VI which would be put into each of the subpanels. If the number of channels is dynamic, I would also add either a channel selector or a vertical scrollbar which scrolls which VI is loaded into the subpanels.


LabVIEW Champion, CLA, CLED, CTD
MediaMongrels Ltd. - NI Alliance Partner (blog)
0 Kudos
Message 12 of 14
(696 Views)

Yes, I agree that it can, indeed, "get messy", particularly if you want to programmatically manipulate individual controls on the Front Panel.  I tend to restrict my control modification to setting/clearing the Visible bit ...

 

BS

0 Kudos
Message 13 of 14
(689 Views)

As requested, the application main interface (sorry for the white blocks but there is the company name in there):

Immagine.jpg

0 Kudos
Message 14 of 14
(659 Views)