Jump to content

Accessing Controls In SubVI Via Reference Cluster


rrojas

Recommended Posts

I have thirty-eight (38) controls on my front panel that I wish to be able to access, and change particular vaues of, in a sub-VI.

What I am doing is creating references for each of the controls on my main VI. Then I am creating controls for each reference and putting each of these reference controls into a cluster.

Then I created a reference to that cluster or reference controls and fed that reference into my sub-VI. I then used a property node to extract the "value" of this reference, which is a cluster. Then I use Unbundle by Name in order to select a particular control reference. I feed this reference into a new value property node to attempt to change its value, but at this point LabVIEW tells me that the object reference is invalid.

Am I going about this the right way or is there a better way to do it?

The image of my sub-VI and the place where I get an error message is attached.

Thanks in advance.

post-1029-1100549207.jpg?width=400

Link to comment

I think you're making things much toooooo complicated.

To modify the content of a control in a sub-vi, just create a reference from the control and feed it to the sub-vi. In the sub vi, use this ref to modify the value/property.

In your example add a bundle before the sub-vi, feed the cluster to the sub-vi, and in the sub-vi unbundle your cluster.

Didier

Link to comment
I think you're making things much toooooo complicated.

To modify the content of a control in a sub-vi, just create a reference from the control and feed it to the sub-vi. In the sub vi, use this ref to modify the value/property.

In your example add a bundle before the sub-vi, feed the cluster to the sub-vi, and in the sub-vi unbundle your cluster.

Didier

2653[/snapback]

I tried that, but I still get an invalid object reference when I unbundle-by-name and feed the reference into the property node.

But just to make sure you and I aren't thinking about different things, what exactly is entailed in making a cluster out of these references? In my block diagram when I created a reference for each of the controls, I was unable to wrap a cluster structure around them. I had to create controls for each reference, which then appeared on the FP, and then I was able to jam these controls into a cluster.

Is there a way I can directly stick the references into a cluster on the block diagram?

Link to comment
I tried that, but I still get an invalid object reference when I unbundle-by-name and feed the reference into the property node. 

But just to make sure you and I aren't thinking about different things, what exactly is entailed in making a cluster out of these references? In my block diagram when I created a reference for each of the controls, I was unable to wrap a cluster structure around them. I had to create controls for each reference, which then appeared on the FP, and then I was able to jam these controls into a cluster.

Is there a way I can directly stick the references into a cluster on the block diagram?

2665[/snapback]

You have to use the bundle function on the diagram and wire each control reference control into the bundlw function. I think the problem occurs when you grab the controls and put them into the cluster. You must do this programmatically as I state.

Link to comment
In my block diagram when I created a reference for each of the controls, I was unable to wrap a cluster structure around them. I had to create controls for each reference, which then appeared on the FP, and then I was able to jam these controls into a cluster.

2665[/snapback]

As Michael stated, wire the references to the "bundle" not "bundle by name". Now on the output of the "bundle" right click and create a control. You directly get a correct cluster-control on your front-panel thich you can copy-paste to your sub-vi. Afterwards just delete the control on your main-vi, since it's not used anymore.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.