I have a GridBox which displays nicely. Except that the row information scrolls off to the right. How do I get the GridBox to have horizontal scrolling? GridBox is not a Container so it does not have any scrolling properties.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you specify Column widths, and then set the GridBox width to less than the sum of the column widths, the GridBox should have a horizontal scrollbar.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think I missed an important detail in my post. I am not using columns in the GridBox. I only have one item to show per row so I just create a row and then add it. So could that be the reason why I don't get horizontal scroll bars?
I'll try using a column, see if that makes a difference.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, that makes sense. When you add rows to a GridBox without adding a Column, the GridBox automatically creates a Column for you. In your case, since you're only displaying one item per Row, I would just create a Column and pass the values as a Collection or String Array or (if you're using Java 1.5) the Column constructor accepts a variable argument length. This way you don't have to create a bunch of Rows. Then, of course, you'd set the width of the Column to be greater than the width of the GridBox. Ex:
GridBox gb = new GridBox;
gb.setWidth(100);
Column c = new Column("val1", "val2", "val3");
c.setWidth(150);
gb.getColumns().add(c);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a GridBox which displays nicely. Except that the row information scrolls off to the right. How do I get the GridBox to have horizontal scrolling? GridBox is not a Container so it does not have any scrolling properties.
Thanks.
If you specify Column widths, and then set the GridBox width to less than the sum of the column widths, the GridBox should have a horizontal scrollbar.
I think I missed an important detail in my post. I am not using columns in the GridBox. I only have one item to show per row so I just create a row and then add it. So could that be the reason why I don't get horizontal scroll bars?
I'll try using a column, see if that makes a difference.
Ok, that makes sense. When you add rows to a GridBox without adding a Column, the GridBox automatically creates a Column for you. In your case, since you're only displaying one item per Row, I would just create a Column and pass the values as a Collection or String Array or (if you're using Java 1.5) the Column constructor accepts a variable argument length. This way you don't have to create a bunch of Rows. Then, of course, you'd set the width of the Column to be greater than the width of the GridBox. Ex:
GridBox gb = new GridBox;
gb.setWidth(100);
Column c = new Column("val1", "val2", "val3");
c.setWidth(150);
gb.getColumns().add(c);
That worked. Thanks a lot.