bigmountainben
10 May 2009, 8:26 AM
GWT 1.6, GXT 2.0-m1 (built as of 5/10/09), Hosted mode
When you have a ComboBox field, and:
- you style the label with a margin component
- you set allowBlank to false
The warning image will not appear in the right place (on top of the combo box arrow).
By contrast applying the same formatting to a TextField works fine.
The example code is below- just tab through the two fields, without any input to demonstrate.
public class Test implements EntryPoint {
public void onModuleLoad() {
Window w = new Window();
w.setHeading("my favorite variables");
w.setWidth(500);
w.setAutoHeight(true);
w.setShadow(true);
w.add(new TestForm(w));
w.show();
}
static class TestForm extends LayoutContainer {
Window w;
TestForm(Window w) {
this.w = w;
FormLayout fl = new FormLayout();
fl.setDefaultWidth(300);
fl.setLabelWidth(100);
setLayout(fl);
setAutoHeight(true);
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
// Some fields
TextField foo = new TextField();
foo.setFieldLabel("foo");
foo.setAllowBlank(false);
foo.setLabelStyle("font-size:16px;margin-right:1em");
SimpleComboBox bar = new SimpleComboBox();
bar.setFieldLabel("bar");
bar.setLabelStyle("font-size:16px;margin-right:1em");
bar.add("Foo");
bar.add("Bar");
bar.add("Baz");
bar.add("Quux");
bar.setAllowBlank(false);
add(foo);
add(bar);
}
}
When you have a ComboBox field, and:
- you style the label with a margin component
- you set allowBlank to false
The warning image will not appear in the right place (on top of the combo box arrow).
By contrast applying the same formatting to a TextField works fine.
The example code is below- just tab through the two fields, without any input to demonstrate.
public class Test implements EntryPoint {
public void onModuleLoad() {
Window w = new Window();
w.setHeading("my favorite variables");
w.setWidth(500);
w.setAutoHeight(true);
w.setShadow(true);
w.add(new TestForm(w));
w.show();
}
static class TestForm extends LayoutContainer {
Window w;
TestForm(Window w) {
this.w = w;
FormLayout fl = new FormLayout();
fl.setDefaultWidth(300);
fl.setLabelWidth(100);
setLayout(fl);
setAutoHeight(true);
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
// Some fields
TextField foo = new TextField();
foo.setFieldLabel("foo");
foo.setAllowBlank(false);
foo.setLabelStyle("font-size:16px;margin-right:1em");
SimpleComboBox bar = new SimpleComboBox();
bar.setFieldLabel("bar");
bar.setLabelStyle("font-size:16px;margin-right:1em");
bar.add("Foo");
bar.add("Bar");
bar.add("Baz");
bar.add("Quux");
bar.setAllowBlank(false);
add(foo);
add(bar);
}
}