Message Edited by altenbach on 08-29-2006 06:54 PM
I just tried putting an XControl inside a cluster inside an array in 2010, and it didn't work. It did work with a regular numeric control. If there's a trick to getting that to work, I'd like to hear how. Can you post an example VI with an XControl somehow embedded in an array (via a cluster, or otherwise)?
I have to be short in my explantation is fairly late in the Netherlands at the moment so I will only show the basics of implementing arrays of XControls.
The basics are:
First of all it is important to know that an cluster is an array of different elements. Thus a cluster is basically an array.
Each XControl has its own instance (context in LabVIEW code). The key is to keep multiple instances of the XControl in the array. The example demonstrates the array functionality in a cluster. (available in less then 5 min). Each element can be changed on two principles. The principle of data flow and the principle of object orientated programming (VI server).
To change a single element in a array you want to change the individual element and not the base object. The array has a base object that works like a template for the rest of the array. This is why the data flow principle will never work on XControls in arrays and thus not really usable. Therefore the cluster (data can also be represented by a variant if you like and later on loaded into a array of XControls) will act like a bounded array. This way you can use data flow to program arrays of XControls.
To change a single element by reference in an array seems a hard thing to do, and well it actually is. But left in a cluster you can make XControls visible or hide them based on the number of elements you have. By reference you don't have to worry about setting the elements in the right position by building a new cluster/array. The only real problem is that when the value is changed each element can be changed individually. When the source changes all elements will change at once.
So if you really want to make an array of XControls for short development time I recommend using clusters as arrays. An array example will follow when I have some spare time 😉