PDA

View Full Version : Struggling with a simple layout



akashani
13 Feb 2009, 4:35 PM
Hi everyone,

I'm evaluating GXT to see whether it'll fit our company's needs. I've created the very simple layout below, which is basically a logo area above a nav bar area. The results are basically as I expect in IE, but not in FF or Chrome. Here's the code:



Viewport view = new Viewport();
view.setScrollMode(Scroll.AUTO);

LayoutContainer main = new LayoutContainer(new RowLayout(Orientation.VERTICAL));

main.add(new Label("Logo"));

LayoutContainer navbarLayout = new LayoutContainer(new RowLayout(Orientation.HORIZONTAL) );

navbarLayout.add(new Button("B1"));
navbarLayout.add(new Button("B2"));
navbarLayout.add(new Button("B3"));
navbarLayout.add(new Button("B4"));
navbarLayout.add(new Button("B5"));

main.add(navbarLayout, new RowData(-1, 48));

view.add(main, new MarginData(5, 0, 0, 0));

RootPanel.get().add(view);


The problem is that the buttons are being given a height of 10px in FF compared to 31px in IE. My understanding was that a RowLayout wouldn't size its children if no RowData was provided, yet they're being sized. Removing the erroneous height (through FireBug) fixes the issue.

Any ideas?

akashani
16 Feb 2009, 11:13 AM
Any ideas here? This is just a straightforward example that I'm hoping some glaringly obvious error will jump out at someone.

akashani
16 Feb 2009, 11:22 AM
A quick clarification: the Button classes being used are GWT buttons, not GXT buttons. If I change to use GXT buttons, the layout is much more consistent across browsers (though FF has some extra "margins" between the each button).