PDA

View Full Version : ColumnLayout and Scrolling problem



maku
30 Aug 2008, 7:56 AM
Hi,

I would want to use ColumnLayout for presenting e.g. a FormPanel on the left and an info view on the right (for describing the content of the FormPanel).

But the FormPanel is NOT scrollable (in the opposite when I layout the FormPanel e.g. with BorderLayout).

Is this a bug?

Could anybody give me an hint?

TIA

Martin

gslender
30 Aug 2008, 4:33 PM
not sure what you want to scroll specifically (the entire border panel or just parts of the form panel etc), but you don't have to use a formpanel - you can use a formlayout on any container that is scrollable... ?? :) - also think 'nested containers' as this sometimes is the solution to layout problems

maku
31 Aug 2008, 6:15 AM
I want that only the FormPanel is scrollable.

When I have to use "only" FormLayout I've several disadvantages because it is less powerful. And the FormPanel is used in our project in a very generic (and generated) way... So it isn't as easy to switch to FormLayout instead.

BTW, when I place the FormPanel instance in a container layouted with BorderLayout and place it in the center area the scrolling happens as expected. I place the info panel in east region of the Container. The disadvantage in this case is that the info panel height because of it is not as height as it is needed (it is as high as the whole container).

gslender
31 Aug 2008, 12:46 PM
put the form panel into another container (like a LayoutContainer) and make it scrollable - ensure the form panel is sized larger than the LayoutContainer.

maku
31 Aug 2008, 2:56 PM
put the form panel into another container (like a LayoutContainer) and make it scrollable - ensure the form panel is sized larger than the LayoutContainer.

I tried it with the following test code:


LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout());

VerticalPanel vp=new VerticalPanel();
for (int i = 0; i < 30; i++) {
vp.add(new Label("Label "+i));
}

LayoutContainer lcSrcollable=new LayoutContainer();
lcSrcollable.setLayout(new FitLayout());
lcSrcollable.setScrollMode(Scroll.AUTO);
lcSrcollable.add(vp);
lcSrcollable.setStyleAttribute("border","1px solid red");

lc.add(lcSrcollable, new ColumnData(.7));
lc.add(new Label("Tralallalal!"), new ColumnData(.3));

But there is no scrolling.

When I use a BorderLayout instead of ColumnLayout (placing lcScrollabel in center and the label in east) I've scrolling of the center area.

What do you mean with "ensure the form panel is sized larger than the LayoutContainer"?

gslender
31 Aug 2008, 4:27 PM
What do you mean with "ensure the form panel is sized larger than the LayoutContainer"?

If you set a layout like FitLayout to the container, the panel below will be resized to fit - and won't need to scroll. You need to make sure the form is bigger and in need of being scrolled in the first place. Probably at least a flow layout on lcSrcollable to ensure the widgets added (the VP) will be able to be the size they need to be and then scrollable.