LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of references from array of controls. How to?

Hi All!
I have dynamically created array of some controls (clusters, for example). How I can dynamically create array of references to each element into original array? Is it possible?

Thanks in advance,
Oleg.


0 Kudos
Message 1 of 10
(6,882 Views)

Hi Oleg,

I don't quite understand your question.  You can use the Controls[] property of the Panel or Cluster class to obtain references to controls on a panel or in a cluster.  Is this what you need?  If not, please attach a VI with a more detailed explanation as to what you are trying to accomplish.

Good luck,

-D

0 Kudos
Message 2 of 10
(6,868 Views)


I'd like create array of references from array of clusters.
0 Kudos
Message 3 of 10
(6,855 Views)

Hi Oleg,

Thanks for posting the VI screenshot, although it's still unclear to me what exactly you are trying to do.  The "array of clusters" indicator on your front panel has a string and a boolean inside of it, so you can very easily create individual control references for those two indicators just by right-clicking them and choosing "Create > Reference"), or you can use the Controls[] property of your cluster to obtain references to the two controls inside it.  There is no such thing as getting a reference to "every" string and "every" boolean in the array, since each array element does not have its own Control Reference...this is because all array elements must have identical property settings.

If this isn't what you're looking for, perhaps you're using the term "references" to mean something different than what it really means in LabVIEW.

-D

Message 4 of 10
(6,852 Views)
Hi Darren,



It's static created arrays. But I'd like creating both arrays dynamically at run-time, as I ask in first message. For example, I read contents of clusters from identical sections of INI file and I don't know number of  elements before executing.

In general, the creating of first array is not a problem, but how I can get the references (like pointers in C/C++) in run-time?

Regards, Oleg.
0 Kudos
Message 5 of 10
(6,837 Views)

As Darren said, all the elements in an array have the same properties. The only different thing is the value of each element. Modifying a property of one element affects all of them. Unfortunately, there is no dynamic GUI device like this in LV. Adding elements to an array is not dynamically creating it, but simply resizing it, and that's the normal use of an array.

The easiest way to get a reference to the element (and there is only one reference), is to right click inside the cluster and to create a reference. Another option is to take a property node pointing to anything on the FP, right-click it and select Link To>>Array>>Cluster>>All Elements. Another option is to get a reference to the array and use the last property (Array Element).


___________________
Try to take over the world!
Message 6 of 10
(6,831 Views)
Thank you all!!!
I undersood.... It was wrong way....

But problem is not resolved 😞 Has the LabView memory allocation ability for some object on run-time? For example, "Create User Event", "Create Notifier" returns new references to object per every call.  Can I do the same without special portion of C/C++ code?

Thanks, Oleg.


0 Kudos
Message 7 of 10
(6,808 Views)
Hello,
 
I realize I'm in late here, but perhaps this will clarify things,at least in the cluster case.  If you are dealing with front panel objects, right clicking and creating references will get you references which you can pass around into subVIs etc.  With those references, you can use property nodes to alter data within your clusters.  If you are dynamically creating an array of clusters, and want to get a reference to it so you can modify it's contents, you can create an indicator for that dynamically created array of clusters, then use the reference to manipulate data in subVIs.  Attached is an example of this; I hope it helps!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 8 of 10
(6,790 Views)
Hello,

I asked about creating array of references to clusters. I attached archive with examples. Please, run both "create array of refs ...." VIs and see content of addresses. I used adapted version of "Clone reference" from OGTK in one case. It's working fine, but not works in compiled application. 😞

And it's very non-standart way in any case, and can work only in toplevel VI.  I search more easy and portable method.

Oleg.


Message Edited by OlegUA on 01-31-2006 02:37 PM

Message Edited by OlegUA on 01-31-2006 02:40 PM

0 Kudos
Message 9 of 10
(6,781 Views)
Hello,
 
Sorry, perhaps I got stuck on your previous comment "I'd like create array of references from array of clusters."  What I was offering was a way to manipulate the clusters in an array, which is presumably what one would do with the references for the individual clusters, but using just the reference to the array.  I thought that may provide you a different way to achieve your desired functionality.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 10 of 10
(6,753 Views)