PDA

View Full Version : Distorted ComboBox



asashour
19 Dec 2010, 5:00 AM
Dear all,

I am trying to have a ComboBox followed by a Widget (Label for instance), and both of them are 60% of the width, centered in the enclosing Form.

For the below code (snapshot is also attached), the ComboBox is distorted, in which the area to edit is much shorter than the given width.

- Using latest version of GWT/GXT/FF323887

Please advise:
- What is wrong?
- How to center the ComboBox (with the following widget) in 60% of the width.

Thanks,
Ahmed


public class TestForm extends VerticalPanel {
final ComboBox<MyTestData> checkBox = new ComboBox<MyTestData>();

public TestForm() {
final FormPanel registerPanel = new FormPanel();
add(registerPanel);
registerPanel.setSize(700, -1);
registerPanel.setFrame(true);
registerPanel.setHeading("My Header");

checkBox.setStore(new ListStore<MyTestData>());
checkBox.setWidth("100%");
checkBox.getStore().add(new MyTestData("Something..."));

final HorizontalPanel hp = new HorizontalPanel();
hp.add(checkBox, new TableData("100%", "100%"));
hp.add(new Label("Hi"));
registerPanel.add(hp, new FormData("100%"));
final LayoutContainer main = new LayoutContainer();
main.setLayout(new TableLayout(3));

registerPanel.add(main, new FormData("100%"));

}

class MyTestData extends BaseModelData {

public MyTestData() {

}
public MyTestData(String text) {
set("text", text);
}
}
}

sven
19 Dec 2010, 6:01 AM
checkBox.setWidth("100%");

That is the problem. You need to either use the GXT layoutsystem or define sizes in pxs.