LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of multi-column listboxes, itemnames property access

Hi,

It's easy enough to assign the "itemnames" property a 2d array of values for a multi-column listbox control.  I can create the "itemnames" property by right clicking on the control in the diagram and creating the property.

I want to use an array of multi-column listboxes, and I am having problems assigning the "itemnames" property when a multi-column listbox is an element in an array.  I am using it in a database application and I want to populate this with database data, kind of a long story what I want to do but I want listboxes to take advantage of the graphical and event properties it offers. 

How can I programmatically assign "itemnames" when it is an element of an array"?  I've tried indexing the element into a control, but this control does not have the itemnames property available.  Also, since the "itemnames" property is essentially a 2d array of strings, I've tried creating this array of 2d arrays (3d array), to the assign to the multi-column listbox array, but labview sees it as 3d array of integers, not strings, so I can't assign this 3d array of text directly to it.

So is it possible to programmatically assign the values of the listboxes text when they are elements of an array?

 

I've attached a vi to attempt to illustrate my point.

 

Thanks for any insight

David Jenkinson

0 Kudos
Message 1 of 5
(4,231 Views)

Hi David,

 

This is Henry from National Instruments Applications Engineering and I see the issue you are running into. It appears since each multicolumn listbox in the array is assigned the same name that the array sees them all as the same control. Something that you may be able to use to achieve a similar effect as an array of multicolumn listboxes would be to make a cluster of multicolumn listboxes. You will be able to use the itemnames property node just as you did in your code to set the itemnames for each separate multicolumn listbox in the cluster. 

 

In the following link it explains how you can programmatically write values to a multicolumn listbox, https://decibel.ni.com/content/docs/DOC-5808 This could be expanded to write values to a cluster of multicolumn listboxes based on the names of the listbox. 

 

Best,

hfar2

0 Kudos
Message 2 of 5
(4,170 Views)

Use this link insead: (for some reason it is adding a period to the end of the link when you click it)

 

https://decibel.ni.com/content/docs/DOC-5808

0 Kudos
Message 3 of 5
(4,163 Views)

From a property node for the array get the Array Element Reference. Cast that to More Specific Class using a reference to a multicolumn listbox. Then you can access the Item Names property.

 

Lynn

 

 

0 Kudos
Message 4 of 5
(4,143 Views)

Lynn showed you one way to do this (although it's easier to just right click the property node and select the Link To option to link directly to the MCLB inside the array), but I don't think that this will actually help you, because all elements of an array share their properties - if you change it in one, it will be changed for the rest as well. If you're only going to show one element of the array this is not an issue, because you can change it when showing a different element, but then there's no point in using an array.

 

I'm not sure what a good solution would be for you, because I don't know what your needs are. I would probably prefer just showing one MCLB and changing its properties based on what the user selects, but that depends on the applicataion.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(4,114 Views)