LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Easier way to adress specific elements in a sub VI running in a sub panel?

Good day!

When running a sub VI in a sub panel, all you have is a ref. The ref allows access to almost everything in the sub VI. When wanting to adress specific front panel elements of the sub VI, which the same as wring an input of the actual sub VI, you need property nodes. The 1st one select the panel, the 2nd the elements, but then you are sort of lost.

 

Let's say you 50 elements on the panel, you could read all labels, sub titles and whatever to find the one you need by it's name. Well, sort of, not exactly. This can take a) quite a long time and b) should you change the element's name in the sub VI you would also have to change the search word. The above snippet would also only work if you actually had set the description, not the subtitle, plus it's case sensitive.

 

Isn't there an easier way? Like when you place a naked property node and assign it to any element on the current panel. LabVIEW could also read all element names from the sub VI and give you a list to select from, but it doesn't do that.

 

find_sub_panel_elements_by_name.png

0 Kudos
Message 1 of 5
(617 Views)

@MaSta wrote:

 When wanting to adress specific front panel elements of the sub VI, which the same as wring an input of the actual sub VI, you need property nodes.


That's not really the "same", but maybe I don't understand what you are saying.

 

Somehow, your entire architecture sounds like a house of cards. Can you take a few steps back and explain what  you are actually trying to achieve with all this? (i.e. try to avoid the how!)

0 Kudos
Message 2 of 5
(596 Views)

In order to identify something (anything), you need to have a unique designator.  But you don't want to use the label of control (or apparently anything else).  It seems that you want to identify controls by magic.

Sorry, there's no magic.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 5
(578 Views)

@MaSta wrote:

Good day!

When running a sub VI in a sub panel, all you have is a ref. The ref allows access to almost everything in the sub VI. When wanting to adress specific front panel elements of the sub VI, which the same as wring an input of the actual sub VI, you need property nodes. The 1st one select the panel, the 2nd the elements, but then you are sort of lost.

 

Let's say you 50 elements on the panel, you could read all labels, sub titles and whatever to find the one you need by it's name. Well, sort of, not exactly. This can take a) quite a long time and b) should you change the element's name in the sub VI you would also have to change the search word. The above snippet would also only work if you actually had set the description, not the subtitle, plus it's case sensitive.

 

Isn't there an easier way? Like when you place a naked property node and assign it to any element on the current panel. LabVIEW could also read all element names from the sub VI and give you a list to select from, but it doesn't do that.

 

 


I have made UIs that use a sub VI for the sub-panel and corresponding handler VI for each sub VI to update the on screen elements of the sub VI. You must set up a framework for the UI so that there are two classes of objects, a 'sub-panel VI base class' which is just a class and a  'sub-panel VI handler base class' which is an actor. Then the basic idea is when you load a VI into a sub panel, it launches its handler which indexes all the on screen objects for the respective sub VI, puts them in a repository that you can then pull a reference to a UI object by searching for the UI objects 'tag'. Its a bit of work up front to get it going, but once you get it up and running it runs on a few basic rules for naming and is highly extensible, you just keep adding windows. Its also portable between projects if you do it right. 

 

You mentioned: 

LabVIEW could also read all element names from the sub VI and give you a list to select from, but it doesn't do that.

 

This is more or less the motivation for the framework I described above. As a developer you want a nice index of the UI objects you have created but LabVIEW does not know how you have structured your UI framework so you need to use class objects and some naming convention to create your own structure and index of elements. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 4 of 5
(568 Views)

If the sub-panel is passive, i'd just use the connector pane to update some value, if it's actually running i'd use a queue or event.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(562 Views)