• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to force HorizontalPanel to wrap

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following:
VerticalPanel
HorizontalPanel
Widget, Widget ...

As I add children widgets to HorizontalPanel, it grows wider and finally adds a scroll bar since it becomes too wide.
I want it to start wrapping children once it reaches certain width, say 90% of the browser window.

How do I do it?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the API docs of HorizontalPanel

A panel that lays all of its widgets out in a single horizontal column.

So wrapping is not possible.
If you want wrapping, check out FlowPanel
 
Jerry Storm
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried FlowPanel. It placed all child widgets vertically, not horizontally. I tries to set width to no avail.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out this example http://examples.roughian.com/index.htm#Panels~FlowPanel
 
Jerry Storm
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My application generates widgets from external data.
I don't know in advance how many widgets will be in a row.
I want them placed in a row from left to right and then when reached the right edge of the window wrap into a new row.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check the example? It does exactly what you require.
 
Jerry Storm
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I was confused. It seems to work. There are a couple of issues here:
- widgets spill over the bottom when a lot are added, I want to have a vertical scrollbar instead of this
- how do I set the width of the flowpanel to about 90% of the screen?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Window#getClientWidth gives you the available width.
Based on this you can compute and use FlowPanel#setWidth()
Check out ScrollPanel. You can wrap your FlowPanel inside the ScrollPanel and then add the ScrollPanel to the parent container
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic