10-04-2016 06:44 AM - edited 10-04-2016 06:44 AM
Hello,
in order to improve my coding ability with labview I need a suggestion on how to manage and update complex interfaces. I had reached good coding ability in modularity and my VI seems pretty ordered. My problem is: how can i manage complex interfaces update in Sub VI?
My solution is pretty simple but very ugly, i often define a type def cluster containing all the reference from my main front panel and pass it through the sub vi. I obtain something like this:
And this is not a good programming style. Solutions? Maybe use the Sub Panel is the best way?
Thank you in advance!
Francesco
10-04-2016 08:00 AM - edited 10-04-2016 08:00 AM
Can you post a screenshot of what your UI looks like?
From the names of the controls/indicators, it looks like you have some repetition (1, 2 and 3) which would be a good use case for using SubPanels. If the panels have the same functionality, then you could use a single reentrant VI and launch 3 instances of it which go into the subpanels (or you could have a 'selector' like a tab control if you don't want to display all 3 at once).
10-04-2016 08:01 AM
Well, you don't provide your VI, so we can't look at your Front Panel, nor can we "play" with it to try out possible solutions (it is almost always a good idea, meaning helpful to you and helpful to us, to attach the VI in question, not a picture).
Something that I noticed was a "bunch of identical" "clusters" of controls. "Bunch of identical" makes me think "Array", while "cluster" makes me thing "Cluster". You could think about grouping Start, Stop_Task, Info, Busy, Info_B, Sub_A, and Sub_B into a single Cluster (you might need two clusters if some are controls and some are indicators, hard to tell from the picture). Then create an array of three of these Clusters. Presto, you've simplified things a lot, and potentially need only a single reference to the Array.
Bob Schor
10-04-2016 08:34 AM
Thanks guys. Both of you have reason, the gui is for a three stations programmer which need to display the results from three tasks made from a reentrant VI. So yes, i think it's best to manage this with a sub panel. Even if i group togheter the controls i always have to send it to the sub VIs, but if i instead use sub panel all the controls are managed inside a single sub vi so it will be simplier. Think i must go and search for a good guide to the subpanel.
10-04-2016 10:44 AM
I'm curious... why do you think your method is bad programming? I've seen this method used quite often, and I really can't see how else to make an "init" subVI. You might consider running the cluster of refs into a FG for convenience, but I think the idea itself is sound.
The real trick, as mentioned above, is to organize your FP controls into arrays and clusters so you don't have a hairball. 😉
10-05-2016 01:12 AM
Because i was able to create (or at least i think.... ) a well ordered and clean block diagram and in some manner the "baloon" on the left seems a little to clumsy.
The second reason is because I spend too much time to rebuild the front panel with new controls, that need to be managed, despite the fact that i already done this in the Sub VIs.
In the above image you can see the main interface cycle, the event structure inside, and one of the three sub loop containing the code for one programming site.
10-05-2016 01:54 AM
By the way, what do you mean with FG, Functional Global? Can you explain better?
Thank you.
10-05-2016 04:09 AM
Hi,
what do you think of creating a cluster of front panel elements instead of a cluster of references?
You could access the single element of the cluster passing to the subVI only the cluster reference and then accessing the single elements with property node
Regards
10-05-2016 06:24 AM
This is a good idea to ordering the block diagram but limit the possibility of the user interface. Clustering controls means graphicaly grouping them all together. Maybe there is a way to hide the cluster border and background?
10-05-2016 06:51 AM - edited 10-05-2016 06:53 AM
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.
I did also ask if you post a screenshot of your user interface (or what you'd like it to look like...) - there might be some further suggestions to help you implement it.