LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to change up to 20 controls on the main VI from a subVI

Hi Community,

 

I have been searching for a good solution for this all day but couldn't come up with anything good. I have around 20 controls on my main VI. I need to access / change their properties from a subVI. ALL the controls are inside a Cluster. I know I can create a reference for all my controls put them in a cluster or array and link it into my subvi ... However this way I end up with a lot of icons on my block diagram ... Does anyone know I better solution to my problem?

 

Thx you for your support

Jan

0 Kudos
Message 1 of 19
(2,990 Views)

@winstroth wrote:

Hi Community,

 

I have been searching for a good solution for this all day but couldn't come up with anything good. I have around 20 controls on my main VI. I need to access / change their properties from a subVI. ALL the controls are inside a Cluster. I know I can create a reference for all my controls put them in a cluster or array and link it into my subvi ... However this way I end up with a lot of icons on my block diagram ... Does anyone know I better solution to my problem?

 

Thx you for your support

Jan


Try using xcontrols.

 

 Br,

 

/Roger

0 Kudos
Message 2 of 19
(2,984 Views)

Hi Jan,

 

when all those 20 controls are inside just one cluster you only need to wire the cluster reference to the subVI.

From that reference you can access references of all the elements of the cluster and select them by their label or control datatype...

 

@Roger:

How can xcontrols help to change properties of controls in a cluster on the frontpanel of a different VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 19
(2,983 Views)

@GerdW wrote:

Hi Jan,

 

when all those 20 controls are inside just one cluster you only need to wire the cluster reference to the subVI.

From that reference you can access references of all the elements of the cluster and select them by their label or control datatype...

 

@roger:

How can xcontrols help to change properties of controls in a cluster on the frontpanel of a different VI?


I usually let a xcontrol handle the changing of properties with a property node wired to the xcontrol reference.

UI events from the xcontrol can also easily be handled using the framework calls, etc.

 

 

Usually UI programming with LV is quite messy and xcontrols helps by removing some of the property node bloat.

Then it is neatly tucked away in a xcontrol and does not overshadow the other parts of the code.

 

But maybe I am missing the point here.. Smiley Embarassed

 

Br,

 

/Roger

 

0 Kudos
Message 4 of 19
(2,973 Views)

Yes use control refs.

 

 

 

There are links below the images here taht will let you find where I discussed these images.

 

Dont get too caried away and don't update the GUI too often using control refs. If you have large data sets the pbest performance comes from usinga control terminal.

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 19
(2,971 Views)

@Ben wrote:

Yes use control refs.

 

<large image removed>

 

There are links below the images here taht will let you find where I discussed these images.

 

Dont get too caried away and don't update the GUI too often using control refs. If you have large data sets the pbest performance comes from usinga control terminal.

 

Ben

 

 


Yes, control refs pointing to a xcontrol can be slow as........ Smiley Mad

Bombarding an (x)control with data in a 1ms loop is quite crappy design.

 

Here's the (x)control references bundled into a class from a sample application I have:

Then I pass the references around to the various loops handling the different parts of the UI.

 

CtrlRefs.JPG

 

Br,

 

/Roger

 

0 Kudos
Message 6 of 19
(2,966 Views)

Hi Jan,

 

I'm not sure if I clearly understand your problem...

It's possible to use the reference to the cluster on the main VI front panel as an input of the sub VI : in the simple attached example, the sub VI changes the values of the numeric controls in the cluster in the main VI.

 

Best regards,

HL

 

PS. Sorry, it's a french version of LabVIEW 😉

Download All
0 Kudos
Message 7 of 19
(2,965 Views)

wow, that's a lot of help for 2 hours.

THX a lot everyone ... I will try to go through it first thing in the morning.

 

Night everyone

Jan

0 Kudos
Message 8 of 19
(2,939 Views)

Now I face another Problem, I want to bundle all my control references into a cluster but I cannot figure out how to do it.

Sry, I am kind of new to Labview.

 

Thx

Jan

0 Kudos
Message 9 of 19
(2,907 Views)

That's where you should look at the Cluster functions palette and use one of the Bundle functions...

 

But:

In your original message you wrote "All controls are inside a cluster". So you only need to get the reference of that cluster, no need to get all the references of all the controls inside the cluster...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 19
(2,902 Views)