LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Combobox dropdown list size

How do I increase / set the size of the drop down list (Number of strings shown at a time)?
0 Kudos
Message 1 of 10
(8,444 Views)
I couldn't find a way to do this with any of the built-in controls, though I can't say I did a complete check. I just checked a couple of the often used controls like the System Combobox or Ring. Obviously, if someone spots it, please correct me.

Alternative 1: If you're on Windows you can use the .NET Combobox which has a property (MaxDropDownItems) that allows you to do this.
Alternative 2: Write an XControl that's basically a combination of two controls, a listbox and one of the pulldowns. Clicking on the pulldown will actually display the listbox. This takes some work, though.

Suggestion: Submit a product feature request.

Message Edited by smercurio_fc on 09-26-2007 09:33 AM

Message 2 of 10
(8,428 Views)
Maybe I'm misunderstanding the question but the number of items in a combo box can be set by manipulating the Strings[ ] or StringsAndValues[ ] property node and the built-in array functions.
0 Kudos
Message 3 of 10
(8,421 Views)
Dennis, I think he means how big of a box is displayed when the user clicks on the control. I.e., the number of items displayed, rather than the total number of items in the control, which is manipulated with the Strings property, as you correctly indicated.
0 Kudos
Message 4 of 10
(8,417 Views)
In the subject it says 'number of strings shown at a time'. It's an array. If the array contains 10 items and he only wants 7 to be displayed, 3 of the items can be removed from the array and rewritten back to the property node.
0 Kudos
Message 5 of 10
(8,411 Views)
Thanks Smercurio and Dennis for your replies,
 
Yes the issue is the number of displayed rows as you have in the listbox properties. Thanks for the advice smercurio,  I thought as much, but dont feel like putting in too much effort. Haven't written an XControl yet, might be a good exercise.
 
Regards
KKDJC
0 Kudos
Message 6 of 10
(8,392 Views)

This is the only message I've seen that asked the same question, and this was over six years ago now so I was wondering if NI had implemented a solution.

I looked at LV 2012 (and the Idea Exchange), but didn't see anything obvious, so is there any Property Node or something that can change the DISPLAYED size of the dropdown menu?

I was hoping that I could read the number of strings in the array list and set the dropdown menu size so that ALL elements can be seen - up to a certain maximum size after which the vertical scrollbar would appear.

 

How is this size actually set?  Is it a key value in the LabVIEW INI file or something?

 

Chris

0 Kudos
Message 7 of 10
(5,408 Views)

@ChrisReed wrote:

How is this size actually set?  Is it a key value in the LabVIEW INI file or something?


As far as I know this hasn't changed, and I'm assuming that the size is set purely in the C code. I have no idea what the actual algorithm is, from a quick test in 2009 it seems to simply be a max value constant - 10 items in the combo box and 21 items in the ring. This number might be affected by things like screen resolution or DPI.

 

The solutions suggested in this thread should work - use a .NET dropdown or create the dropdown yourself using a listbox.


___________________
Try to take over the world!
0 Kudos
Message 8 of 10
(5,400 Views)

Thanks tst for your response,

I want to avoid using .NET unless its absolutely necessary, because it's another dependency I have to worry about and we are installing this application on a fair number of computers (30+) and each computer's hardware/software is quite varied.

 

Sounds like I might have to put a request in to the LabVIEW Idea Exchange Smiley Wink

 

Chris

0 Kudos
Message 9 of 10
(5,397 Views)

I know this thread is long dead but I just came across it looking for something similar and stumbled on a solution so I thought I would share. It works in LV2020 and probably at least some older versions. If you customize the combo box, (Right click, Advanced, Customize) and then click "Change to customize mode" (looks like a wrench icon), it will show the list box that is displayed when the dropdown is activated. You can change the size of the dropdown then close the customization and apply it to your control. Then when you select the dropdown it should use the new length. I don't know what if anything this might break but it seems to work ok.

Message 10 of 10
(361 Views)