View Full Version : Can combobox list be larger than the box field?
TheBuzzer
21 Oct 2008, 3:38 PM
I am wondering can the drop down menu from the combobox be larger than the combobox field itself?
because stuff are getting cut off in the combo box and the dropdown list.
I dont care if stuff get cut off in combobox but the dropdown list i want it to show everything.
posta07
22 Oct 2008, 6:25 AM
try this... (i don't know if this works, but it's worth a shot...)
ComboBox allows you to get access to its ListView object...
ListView view = combo.getListView();
view.setWidth(300);
TheBuzzer
22 Oct 2008, 7:11 AM
just tried it didnt do anything.
I think it might have to do with some styling of css but if I try to changte the style it doesnt even show the list at all.
posta07
22 Oct 2008, 7:41 PM
just tried it didnt do anything.
That's true. It does nothing because the actual ListView object is inside a LayoutContainer object which has its size and style set by the ComboBox. Using FireBug inside of FireFox you can cause the CSS to make the ListVIew bigger, but I think programmatically accessing something like that would require Darrel's help
gslender
24 Oct 2008, 4:14 AM
consider extending combobox and adjust ?
AndreD
27 Oct 2008, 12:54 AM
You could set the minimum list width with the method setMinListWidth(int width) of ComboBox.
TheBuzzer
28 Oct 2008, 4:34 PM
setMinListWidth()
worked
thanks
b4babu
7 Nov 2008, 9:35 AM
Could you please share your piece of code to me, I have similar problem...
kolli
14 Nov 2008, 5:57 AM
well it is nothing but setting [code]comboBox.setMinListWidth(200); [code]
This actually increases the width of the list while the comboBox is of the same width
NotChris
14 Jul 2009, 5:04 PM
I have also been trying to set a different width from the box field for the combobox list. But I would also like to set a smaller width for the combobox list.
I am using the following but do not see any difference on the combobox list when the value of width is smaller than the box field. In this case, the combobox list width is the same as the box field. Is it possible to do this? Any help would be appreciated.
int width = model_.getMaxNameWidth(_comboBox.getListView().el());
_comboBox.setMinListWidth(width);
public int getMaxNameWidth( El el )
{
TextMetrics metrics = TextMetrics.get();
metrics.bind( el );
for( NameValueItem item : items )
{
if( item.getName() != null )
{
_maxNameWidth = Math.max( _maxNameWidth, metrics.getWidth( item.getName().getString()) );
}
}
return _maxNameWidth;
}
NotChris
14 Jul 2009, 6:06 PM
OK, I have found out from other threads that setMinListWidth can only be used when setting the width of the combobox list to be larger than the box field but how do you set it to be smaller?
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.