LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Selected Item(s) in a ListBox Control

Solved!
Go to solution

In LabVIEW 2010 I have a ListBox Control. How do I get a list of the Item(s) that the User selected in the ListBox?

 

I don't see any Method, Property or Event that would provide this information.

 

Thanks.

0 Kudos
Message 1 of 10
(22,927 Views)
Solution
Accepted by topic author dbaechtel

The value of the listbox are the indices of the elements selected.

If you allow the user to select '0 or more' elements, the datatype will change to an array.

To get the names of the selected elements (I guess that's what you're interested in), you should indes the 'Item Names' property.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 10
(22,920 Views)

You can use the list box itself or a value property node to get the indeces of the items selected.  The following picture shows that items one, two, and three were selected.  The Selected Items array contains the indeces of the selected items.  You can use these indeces to get the selected item names.

 

23538i669FB92A16367DDC

- tbob

Inventor of the WORM Global
Message 3 of 10
(22,907 Views)

Hi, How can I make a list that each item in the list has a certain vaue or string which appears in the output, for example I have a list from 1 to 10, eash number has a correspndance string, ths sting appears in the output.

 

Regards

 
0 Kudos
Message 4 of 10
(19,789 Views)

ysma,

 

I think your question was already answered in the previous post on this thread... the code uses a property node to output the choices the user selects.  However, if you don't want to do it that way, and you want the user to select a number (say 0-9) and then output a string associated with that number, you could create an array of strings you want them to choose from and when the user selects the number it will correspond to an index of that string array.

 

I hope that helps!

------------------------------------------------------------------------------------------

Jon F.
Technical Support Engineer
National Instruments
0 Kudos
Message 5 of 10
(19,758 Views)

Hi,

 

I have been trying to find the selected item in labview 2011. I cant find it anywhere. Can you please help me access the selected item in labview 2011. Thank You.

0 Kudos
Message 6 of 10
(15,921 Views)

Hi vindsan,

 

The Selected Item indicator is simply an array of I32 numeric indicators that is wired through to the listbox. By creating an array of I32's, when wired to the list box, it will pull the numeric representation instead of the string. 

 

BeenCoughin

Message 7 of 10
(15,870 Views)

I've posted this many times on the forums, but it is some wrapping code I wrote that makes selection of items in a listbox, or tree, eaiser for the user and developer.  Selection is done by clicking the check boxes, with right click for select all / none.  Visually I think this is more what users of sofware are expecting, not the normal LabVIEW situation where you need to hold Shift, or CTRL.

 

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

0 Kudos
Message 8 of 10
(15,802 Views)

Thank you!

NI System Configuration:
- NI PXIe-1071, 4-Slot 3U PXI Express Chassis , 1 GB/Slot throughput, Part Number: 781368-01
- NI PXIe-PCIe8381,x8 Gen2 MXI-Express for PXI Express Interface,3m, Part Number: 782522-01
- PXIe-5160 PXI Oscilloscope, 500 MHz, 10 bits, 2.5 GS/s, 2 Channels, 64 MB, Part Number: 782621-01
- Astronics PXIe-1209 2-Channel, 100 MHz PXI Pulse Generator, Part Number: 785033-01
0 Kudos
Message 9 of 10
(7,835 Views)

short and simple: thank you!

0 Kudos
Message 10 of 10
(3,540 Views)