PDA

View Full Version : Scroll doesn't appear in the ContentPanel



makados
12 Jun 2008, 2:23 AM
Hi there,
I have wrapper on two other panels implemented as ContentPanel. One of my panels is Collapsible and appears collapsed. I want wrapper panel to show scroll when my panel is uncollapsed so user can find his needed components. And all of that are in the Dialog. Here is the code:


public class ContactDialog extends Dialog {
public ContactDialog() {
setModal(true);
setResizable(true);
setBodyBorder(false);
setInsetBorder(false);
setButtons(Dialog.OKCANCEL);
setIconStyle("icon-app-side");
setHeading(MCMessages.msg.cw_title_create());
setWidth(GuiConstants.CONTACTWINDOW_WIDTH);
setHeight(GuiConstants.CONTACTWINDOW_HEIGHT);
setHideOnButtonClick(true);
setLayout(new FillLayout());
setScrollMode(Style.Scroll.ALWAYS);

FormPanel formPanel = new FormPanel();
formPanel.setLabelWidth(100);
formPanel.setFieldWidth(-1);
//formPanel.setIconStyle("icon-form");
formPanel.setFrame(true);
formPanel.setWidth(400);
formPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);
formPanel.setHeading("form header");

//some fields are added to formPanel

final ContentPanel wrapperPanel = new ContentPanel(new RowLayout());
wrapperPanel.setScrollMode(Style.Scroll.ALWAYS);
wrapperPanel.setHeaderVisible(false);
wrapperPanel.setFrame(true);
add(wrapperPanel);
wrapperPanel.add(formPanel);

TableLayout tl = new TableLayout(2);
final ContentPanel attrPanel = new ContentPanel();
attrPanel.setCollapsible(true);
attrPanel.collapse();
attrPanel.setHeading("attr header");
attrPanel.setLayout(tl);
wrapperPanel.add(attrPanel);

//some fields are added to attrPanel
}

gslender
12 Jun 2008, 12:51 PM
change the layout to FlowLayout at around line 13

andrey
13 Jun 2008, 4:20 AM
Why should it make it a difference to change from FitLayout() to FlowLayout() when the scrollMode of the panel is set to AUTO or ALWAYS?

Anyway, my app had a dialog which had a ContentPanel with a Table in it. With Beta5, the scrolling no longer works when the table's contents exceed the view area no matter if I use FlowLayout() or FitLayout(). So it seems this is a regression (sigh).

- Andre

andrey
13 Jun 2008, 7:11 AM
Whoops! I discovered that I was missing the call to ContentPanel.setScrollMode(Scroll.AUTO) in my code. I've done some testing and if I use the suggestion to use a FlowLayout instead of FitLayout combined with calling setScrollMode(AUTO), things work as expected. However, something seems to have changed in GXT from beta4 to beta5 and I still would like to understand why it only works with FlowLayout.

As an aside, wouldn't it make sense for the default scroll mode to be AUTO instead of NONE?

Thx,
Andre

makados
13 Jun 2008, 7:14 AM
support setting default scroll mode to AUTO. And also support question why It works only with FlowLayout?

gslender
13 Jun 2008, 1:06 PM
scrolling only makes sense for layouts that don't try to fill all available space - ie these layouts are trying to resize their children to be their container parents size - if the containing parent is scrollable, and the layout is FillLayout, then the child will always only be as big as the containing parent, never bigger (so no scroll bars) :-?

Flow layout lets children be as big as they need to, thus allowing scroll bars show when needed :D