LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I force user to select n elements in a list box control

hi

I have listbox and user can select multi lines but I would like to force the user to always select 4 lines . Could you please let me know hpow can I do it in program

Thanks

0 Kudos
Message 1 of 6
(2,895 Views)

What do you want to have happen if the user selects less than 4 items? Or more than 4 items?  Pop up a dialog box?

 

You can check the length of the array of the listbox.  Do it in a while loop and only exit the loop if it is equal to 4.  Pop up a dialog if it is not equal to 4.

0 Kudos
Message 2 of 6
(2,894 Views)

Easiest would be an event structure where you check the size of the listbox array. Set a flag once exactly four items are selected and e.g. enable a button that is disabled for any other number of items.

 

 

Typically users need to select one item at a time (e.g. by ctrl-clicking). So constantly throwing dialog boxes at the user would interfere strongly with the user experience. Not recommended).

0 Kudos
Message 3 of 6
(2,886 Views)

Here's a quick example:

 

 

Download All
0 Kudos
Message 4 of 6
(2,877 Views)

Also, be sure to inform the user of your expectations. Selecting 4 things from a single list is not likely to be something that a person would intuitively understand. Use on-screen instructions or tip strips to tell the user what you want. You could also have a count down indicator showing how many selections there are left to make.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 6
(2,850 Views)

I like the count down indicator idea.

 

Lynn

0 Kudos
Message 6 of 6
(2,845 Views)