10-19-2012 02:30 AM
@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
10-19-2012 07:24 AM
@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.
10-19-2012 02:03 PM - edited 10-19-2012 02:03 PM
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
10-19-2012 02:23 PM
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
10-19-2012 02:34 PM
@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
10-19-2012 02:39 PM - edited 10-19-2012 02:40 PM
@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:
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
10-19-2012 02:47 PM
@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
10-19-2012 02:51 PM
Cool code Ben! Have to have a look at it!
10-20-2012 05:53 AM
Hi,
Pass your Main VI reference to a SubVI and see the example attached.