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


@winstroth wrote:

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


Right-click the control reference, select "create constant", copy the constant to the cluster.

 

Br,

 

/Roger

 

0 Kudos
Message 11 of 19
(625 Views)

@User002 wrote:

@winstroth wrote:

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


Right-click the control reference, select "create constant", copy the constant to the cluster.

 

Br,

 

/Roger

 


 

 

A short-cut to help create the cluster in the first place is found in this Nugget that exploits the little used middle input of a bundle (not a bundle by name, that comes latter).

 

Here is a preview

 

 

But you will have to llok at that nugget to get the full story.

 

Ben

 

PS I would like to offer a special shout-out to Greg McKaskle for giving me that idea.

 

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

You can use a reference of your cluster to change the properties of the controls inside by using the "Controls[]"-Property of the cluster. You can for example change the disabled-status of all your controls by the attached diagram.

For this, you have to use a property that all controls have in common. Special properties like for example cursor lists of a graph can't be changed this way as not all controls have this property.

 

Another interesting thing to mention: If you use your controls in a cluster, you can't access an individual control's value without unclustering. Positioning the controls on a tabbed-page control, you have control to the individual controls on your block diagram, but you can also use the reference "Controls" of your tab page for accessing the properties of all controls...thus combining the advantages of a cluster with an easier to program access to the individual controls.

 

Hope this helps,

 

best regards,

 

Christian

snippet.png


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 13 of 19
(584 Views)

Cschneider wrote :

"If you use your controls in a cluster, you can't access an individual control's value without unclustering"


 

The very simple example I've given here did it !

 


Cschneider wrote :

"you have to use a property that all controls have in common"


 

No, if you are able to identify a control (by its name for example) you may read or write specific properties by casting the reference to a less generic one.

 

HL

Message 14 of 19
(575 Views)

@Herlag wrote:

Cschneider wrote :

"If you use your controls in a cluster, you can't access an individual control's value without unclustering"


 

The very simple example I've given here did it !

 


Cschneider wrote :

"you have to use a property that all controls have in common"


 

No, if you are able to identify a control (by its name for example) you may read or write specific properties by casting the reference to a less generic one.

 

HL


Agreed!

 

See this Nugget for more on casting unknown refs.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 15 of 19
(566 Views)

@Herlag wrote:

Cschneider wrote :

"If you use your controls in a cluster, you can't access an individual control's value without unclustering"


 

The very simple example I've given here did it !

 

No, you also have to access it by some "sort" of unclustering, in this example by using the indexing of the for loop...what I mean is the following case:

 

snippet.png

 

As you can see, you can access now the individual controls by their terminals AND by a common reference, another way of grouping VIs without using clusters.

 


Cschneider wrote :

"you have to use a property that all controls have in common"


 

No, if you are able to identify a control (by its name for example) you may read or write specific properties by casting the reference to a less generic one.

 

Yes, you are right...but as you said, for this, you have to cast your reference to a more specific class where you have to identify the class of your control somehow...

 

 

Christian


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 16 of 19
(559 Views)

@cschneider wrote:

... 

Yes, you are right...but as you said, for this, you have to cast your reference to a more specific class where you have to identify the class of your control somehow...

 

 

Christian


Yes see the Nugget i linked above to see one approach.

 

Ben

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

Cool code Ben! Have to have a look at it!


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
Message 18 of 19
(548 Views)

Hi,

 

Pass your Main VI reference to a SubVI and see the example attached.

0 Kudos
Message 19 of 19
(529 Views)