PDA

View Full Version : [CLOSED] Margins issue in a FlowLayouted viewport



zaccret
30 May 2008, 1:02 AM
Env : Windows XP, GXT 1.0 beta3
If I add a panel in a flow-layouted container, the margins are not used. Maybe it is related to this similar bug http://extjs.com/forum/showthread.php?p=175432 but here it occurs on both FF2 and IE6 and I don't see any "margin: 15px;" or similar in the DOM with Firebug/IE Toolbar.

public void onModuleLoad() {
final Viewport viewport = new Viewport();
FlowLayout layout = new FlowLayout();
layout.setMargin(15);
viewport.setLayout(layout);
final ContentPanel formPanel = new ContentPanel();
formPanel.setHeading("My panel");
formPanel.setWidth(350);
formPanel.setHeight(100);
viewport.add(formPanel);
RootPanel.get().add(viewport);
}

zaccret
9 Jun 2008, 10:40 PM
The same with beta4

zaccret
12 Jun 2008, 1:47 AM
Still in beta5 :(

zaccret
12 Jun 2008, 4:49 AM
Note that I have the same bug in Quirks mode. Maybe my usage of the API is wrong ? Cannot I set margins on the viewport ?

darrellmeyer
12 Jun 2008, 6:29 AM
Viewport will remove its margins padding. You can either add you form panel to another container, or assign the margin to the form panel itself:


public void onModuleLoad() {
final LayoutContainer lc = new LayoutContainer();
FlowLayout layout = new FlowLayout();
layout.setMargin(15);
lc.setLayout(layout);
final ContentPanel formPanel = new ContentPanel();
formPanel.setHeading("My panel");
formPanel.setWidth(350);
formPanel.setHeight(100);
lc.add(formPanel);
RootPanel.get().add(lc);
}

// or
formPanel.setStyleAttribute("margin", "15px");

zaccret
12 Jun 2008, 7:15 AM
Ok. Thanks :), it works and I have the same result on both IE6 and FF with the lines you add :

formPanel.setHeight(100);
formPanel.setStyleAttribute("margin", "15px");Note that it doesn't work on Firefox in Standard Mode with

layout.setMargin(15);

zaccret
20 Jun 2008, 1:45 AM
It works on both IE6 and FF3 with the new doctype requirement. See http://extjs.com/forum/showthread.php?t=38334