Jump to content

Changing a single elemenet of a cluster


Recommended Posts

Hi people,

I would like to share a little problem with Labview. I have a VI with a cluster which can be changed from the exterior (thanks to a connector). I would like to know if it is possible to change a single element of this cluster from another VI, without changing or putting the other values of the other elements in the cluster.

Is it possible?

Thanks in advance :headbang:

Link to comment

Well, if "another VI" is a VI within your application, you can easily get a reference to the cluster and access the Controls[] property to get an array of references to each control in the property which you can check by label name usually (for loop + name comparison). That can get you the reference for a single control in your cluster which can be used to read or change the value.

If "another VI" is a VI not within your application you can still get a reference by opening a VI reference and traversing the class tree, albeit slightly more complicated. It's basically the same as above though. I would look at some of the examples in the scripting forum on that note.

Link to comment

To update a value of a cluster, don't do it via a reference. Unless you like slow and complicated code it is usually better just to pass the value of the cluster around.

Use references to affect how the cluster looks or behaves. Unless you have a compelling reason, don't use references to just to update a value.

If you've found that every time you change what the cluster holds that all your sub-vis break, you should turn your cluster into a type def.

Sparc

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.