Menu

How do I get a GridBox to scroll horizontally

2006-08-24
2013-04-24
  • Nobody/Anonymous

    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.

     
    • Ted C. Howard

      Ted C. Howard - 2006-08-24

      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.

       
    • Nobody/Anonymous

      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.

       
    • Ted C. Howard

      Ted C. Howard - 2006-08-26

      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);

       
      • Marty Wegner

        Marty Wegner - 2006-08-28

        That worked.  Thanks a lot.

         

Log in to post a comment.

MongoDB Logo MongoDB