09-04-2008 05:03 PM
I've got kind of a two part question. The first one is pretty straight forward and basicly a stripped down issue from my second question. Is there a way to pass a ring control to a sub vi, have the sub vi manipulate the control (I.E. add ring strings, etc) and then pass the modified control back without losing control configuration? When I pass it in I seem to lose all of my ring strings and then to return it it, it needs to be an indicator which means I obviously lose everything.
Second question is more difficult. I have an array of clusters. Inside the clusters is a ring control. How can I pass this array to a sub vi and have it do the same thing I mentioned in question one? I pass the array by refnum but I can't seem to find a way to dereference it to get at the clusters.
Sorry if this is a bit confusing. If I need to clairify more I will.
09-04-2008 08:49 PM
You've actually answered your first question with your second question: using references. References allow you to manipulate controls/indicators of parent VIs from subVIs. If you haven't seen it, there's an example that ships with LabVIEW called "Property Nodes". The easy way to get a reference:
Note that there's no passing of reference "back" to the parent VI.
As to your second question: This one is more involved, as it requires typcasting the array element. Basically, you need to get the array element, cast it as a cluster, and then you can loop through its list of controls. When you get to the one with the name of the one you want you typecast it to a ring and modify its Strings[]. See attached example.
Side-Note: I don't know exactly what you're trying to do, but perhaps you should look into typedefs.
09-05-2008 11:06 AM
Thank you very much for the example VI's. Typecasting is the missing link. I see how you set the strings for all clusters in the array. Let me ask one last question. Is it possible for me to reference just one cluster from the array? For example say I want to set the current value of just one control that's in one cluster, not all of them. How do I dereference the array? After that I know the same typecasting applies.
Thanks again.
09-05-2008 11:16 AM - edited 09-05-2008 11:16 AM
There is no dereferencing involved. You wire the reference to a Property Node and select the "Value" property. This will be the array, and you can use standard array functions to set an element of the array. Then, just write the new array back using another "Value" property node.
09-05-2008 12:18 PM