I'm having a strange problem with ListBox. I am adding a ListBox inside a Grid (not sure if that makes a difference with this problem). If I do not set the width or height of the ListBox, it looks perfect and expands to fill its cell of the grid. However, not all of the data that is supposed to be within the ListBox is there (i have added about 16 values to the ListBox model, but only 7 of them show up in the listbox). If I merely hard code the width of the ListBox, all of the data will be there.
For example, I have:
Grid layoutGrid = new Grid(1);
layoutGrid.setWidth(new Extent(100, Extent.PERCENT);
layoutGrid.setHeight(new Extent(100, Extent.PERCENT);
DefaultListModel lm = new DefaultListModel();
String[] values = getData(); //returns 16 different values
for( int i=0; i<values.length; i++)
{
lm.add(i, values[i]);
}
ListBox listbox = new ListBox(lm);
//listbox.setWidth(new Extent(100));
layoutGrid.add(listbox);
--> this code will not show all 15 values in the listbox unless I uncomment the line where the listbox width is hardcoded. Also, if I change that to a percentage width, it will not work. I would really like the width to not be hardcoded, but I'm not sure what to do.