ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

listbox selection

I have two listbox with multiple selection enabled,by clicking (single click) one item of the first listbox I want to populate the second, so I'd like to know which row (index) has been selected.
I'm using LabView 6.0.
Thanks everyone.
0 Kudos
Message 1 of 7
(3,675 Views)
Please find attached some fairly general code in LV 6.0.2. It's not going to win any awards, but if you tinker with it a bit, you should be able to get the behavior you want.
0 Kudos
Message 2 of 7
(3,675 Views)
The listbox's control itself is the items selected. If you've defined the listbox's selection mode as 0 or 1 Item or 1 Item, the control is a single I32. If the selection mode is 0 or More Items, or 1 or More Items, the control is an I32 array.
0 Kudos
Message 3 of 7
(3,675 Views)
Thank you for your answer, but I can't find anyway to solve my problem. I don't know how to get the clicked row of a multi-selectable listbox, the attached array reports me the list of the selected rows and I can't find out which is the last one I've clicked (with a single click of the mouse).
0 Kudos
Message 4 of 7
(3,675 Views)
If I understand the problem (and I'm not entirely sure I do) it sounds like you need something a little more complex to determine what the last one clicked is. The listbox itself has no information on what order things are clicked in, so you have to provide it.

In the example I've posted, the last item clicked in Listbox will be listed last in the ItemNames array from Listbox 2.

It's also possible to imagine attaching an "order" integer to each selection. For instance, each selection could be kept in a cluster containing a string (the selection) and an integer (the order in which it was selected).

If needed, please feel free to post example code of what you're trying to accomplish.

Good coding.
0 Kudos
Message 5 of 7
(3,675 Views)
Bah, it must be too early in the morning, my apologies. For the comment starting "In the example..", this only applies for single selections.
0 Kudos
Message 6 of 7
(3,675 Views)
You have understood the problem, I've just solved it trapping the last double-click on a row of a listbox (instead of single-click).
Thank you very much for your time.

Max P.
0 Kudos
Message 7 of 7
(3,675 Views)