View Full Version : correct way to have scrollbars show dynamically

17 May 2009, 6:43 PM

I think that maybe this is problem with the parent layout but I have a FormPanel inside a LayoutContainer with the FlowLayout

I have tried setting the scroll to Scroll.AUTOY but the problem is, I think, separate from that.
If I do not set a height in the FormPanel, it is calculated to what looks like to be 0 pixels high. If I do setAutoHeight(true) the form panel shows up but no scrollbars show up. I understand from reading through the forums that you won't get scrollbars with auto height but how can you get scrollbars only when you need them?

Oh, and I can't set the height statically because it will change depending on if some content panels are expanded or collapsed and also depend on the size of some dynamically created radio lists.

Thank you very much for any help you might have to offer.

Joe Hudson

25 Jul 2009, 2:25 PM

setStyleAttribute("overflow", "auto");

on the layout container.

26 Jul 2009, 3:45 PM
thank you very much for the reply

26 Jul 2009, 6:25 PM
One addition: if there will be a problem with contained components' width computation due to the dynamically appearing vertical scrollbar, you can use ColumnLayout on the container, and set it .setAdjustForScroll(true), then add compos with new ColumnData(1d) to it.