10-18-2012 01:09 PM
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
10-18-2012 01:15 PM
@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
10-18-2012 01:16 PM - edited 10-18-2012 01:17 PM
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?
10-18-2012 01:37 PM
@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...
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..
Br,
/Roger
10-18-2012 01:38 PM
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
10-18-2012 01:45 PM
@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........
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.
Br,
/Roger
10-18-2012 01:45 PM
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 😉
10-18-2012 03:12 PM
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
10-19-2012 02:16 AM
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
10-19-2012 02:29 AM - edited 10-19-2012 02:31 AM
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...