PDA

View Full Version : HBoxLayout isn't resizng content if it palased in TableLayout



vivanov
9 Apr 2012, 1:49 AM
Hello.
I have LayoutContainer with HBoxLayout which placed into LayoutContainer with a TableLayout.
When I resize browser window, TableLayout and HBoxLayout are resizing, but content of HBoxLayout does not do it.

package com.mySampleApplication.client;
import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.util.Theme;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.*;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;

/**
* Entry point classes define <code>onModuleLoad()</code>
*/
public class MySampleApplication implements EntryPoint {
private Viewport viewport;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
GXT.setDefaultTheme(Theme.GRAY, true);
viewport = new Viewport();
viewport.setLayout(new FlowLayout());
TableLayout tableLayout = new TableLayout(2);
tableLayout.setBorder(2);
LayoutContainer panel = new LayoutContainer(tableLayout);
TextBox textBox;
HBoxLayout hBoxLayout;
HBoxLayoutData hBoxLayoutData;
TableData tableData;
// Adding two TextBoxes to first row in to each Column
textBox = new TextBox();
textBox.setWidth("100%");
tableData = new TableData("100%", "24px");
panel.add(textBox, tableData);
textBox = new TextBox();
textBox.setWidth("100%");
tableData = new TableData("100%", "24px");
panel.add(textBox, tableData);
// Creating HBoxLayout
LayoutContainer hContainer = new LayoutContainer();
hBoxLayout = new HBoxLayout();
hBoxLayout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
hContainer.setLayout(hBoxLayout);
textBox = new TextBox();
hBoxLayoutData = new HBoxLayoutData(new Margins(0, 5, 0, 5));
hBoxLayoutData.setFlex(1);
hContainer.add(textBox, hBoxLayoutData);
textBox = new TextBox();
hBoxLayoutData = new HBoxLayoutData(new Margins(0, 5, 0, 5));
hBoxLayoutData.setFlex(2);
hContainer.add(textBox, hBoxLayoutData);
tableData = new TableData("Auto", "100%");
tableData.setColspan(2);
hContainer.setHeight("24");
panel.add(hContainer, tableData);
viewport.add(panel);
RootPanel.get().add(viewport);
}
}

sven
9 Apr 2012, 1:55 AM
TableLayout is not resizing its children. This means that your container with your HBoxLayout is also not resized and so also does not resize its children.

vivanov
9 Apr 2012, 2:10 AM
Thanks. :(