LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple selection front panel item

Solved!
Go to solution

Hello

 

I was wondering if there is a front panel item that would behave as an excel table in a sense that you could select multiple cells by holding down CTRL (to select multiple different items) or SHIFT (to select a range of items).

 

I have tried Multicolumn Listbox, which only allows a single item selection, and Table Control, which allows a range of items to be selected, but not multiple different items. Table Control also enters "edit" mode upon clicking on a cell, even if editing is disabled. 

Tree item allows neither properly so it's out.

 

Basically what i need is a list of items (with columns such as ID and some descriptors) from which you could select several and delete them. 

I can't do it with radio buttons or similar either, as there are up to 200 different items on the list and it needs to be scrollable.

 

Examples:

AeroSoul_0-1606985018262.png

list of items

 

AeroSoul_1-1606985047064.png

Selected items 1 and 3

 

AeroSoul_2-1606985071135.png

Selected range of items 1 through 3

 

 

 

 

 

Thanks for your help

0 Kudos
Message 1 of 9
(2,110 Views)

Hi AeroSoul,

 


@AeroSoul wrote:

I have tried Multicolumn Listbox, which only allows a single item selection,


In a MultiColumnListbox you can select more than just one item. You just need to allow such selections…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(2,102 Views)

Thanks for a fast answer.

 

How can i enable this option?

Property node Selection Mode doesn't seem to work (i can only input values 0 and 1, anything greater returns an error upon starting the VI).

And how can i tell which cells are selected? Table Control has a property node of Selection Start and Selection Size, but i don't see this option for Listbox.

0 Kudos
Message 3 of 9
(2,099 Views)
Solution
Accepted by topic author AeroSoul

Hi AeroSoul,

 


@AeroSoul wrote:

How can i enable this option?


Use the context menu (aka right-click menu) of the MCL: there you can choose the selection mode…

 


@AeroSoul wrote:

And how can i tell which cells are selected?


The MCL value is an array containing the indices of selected rows when you allow a multiselection mode…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(2,096 Views)
Solution
Accepted by topic author AeroSoul

I mistakenly wrote a long response to this, but actually the better answer is as follows:


@AeroSoul wrote:

I was wondering if there is a front panel item that would behave as an excel table in a sense that you could select multiple cells by holding down CTRL (to select multiple different items) or SHIFT (to select a range of items).

 

I have tried Multicolumn Listbox, which only allows a single item selection,...


The bit in red isn't true - right click on your listbox and go to Selection Mode, then choose "1 or more items" (or 0+, if you want to allow no selection), then perhaps also choose "Highlight Entire Row". The default datatype becomes an array of indices selected.

 

See the following example:

Example_VI.png

 

This (at least in 2019) allows the Ctrl / Shift behaviour you wanted.

example.png


GCentral
Message 5 of 9
(2,089 Views)

Oops - failed to refresh after spending a bunch of time investigating .NET class options for this and looks like it's already been answered! Should have read the question more carefully from the beginning...


GCentral
0 Kudos
Message 6 of 9
(2,087 Views)

Thank you very much, works like a charm!

0 Kudos
Message 7 of 9
(2,076 Views)

I have another question.

Is there a way to tell if the selected item is index 0 (first item on the list) or no item is selected?

Because value of both is the same and it kinda screws with my selection. Currently i bypass this by leaving the first row empty.

0 Kudos
Message 8 of 9
(2,011 Views)

@AeroSoul wrote:

I have another question.

Is there a way to tell if the selected item is index 0 (first item on the list) or no item is selected?

Because value of both is the same and it kinda screws with my selection. Currently i bypass this by leaving the first row empty.


This shouldn't happen - if you want to allow not having anything selected, make sure you have the selection mode set to "0 or more items" and not "1 or more items".

Then, the default output (without nothing selected) should be an empty array, like this:

cbutcher_1-1607437506112.png

 

until you select something. (The elements in "Array" are all greyed out, indicating they're empty).

You can hold Control and click the same item to deselect it.

 

A selected row 0 would appear like this:

cbutcher_3-1607437608971.png

 

(I failed to select the "Highlight Entire Row", so it looks a bit odd here, but you could choose that option too as I mentioned before and showed in my first post).


GCentral
0 Kudos
Message 9 of 9
(2,002 Views)