-
24 Apr 2008 7:26 AM #1
FormPanel & gwt widgets like ListBox
FormPanel & gwt widgets like ListBox
Why I can't add to FormPanel any gwt widgets like ListBox?
But form panel is empy.Code:FormPanel panel = new FormPanel(); panel.frame = true; panel.fieldWidth = 300; panel.labelWidth = 200; panel.buttonAlign = HorizontalAlignment.CENTER; panel.setHeading(getPageTitle()); panel.setIconStyle("icon-form"); panel.setWidth(600); panel.setStyleAttribute("padding", "20"); final ListBox lb = new ListBox(); lb.setWidth("200px"); lb.setVisibleItemCount(1); lb.addItem("item 1 "); lb.addItem("item 2 "); lb.addItem("item 3 "); panel.add(lb); final TextBox tb = new TextBox(); tb.setText("xxxx"); panel.add(tb);
(I work with Firefox browser)
-
24 Apr 2008 7:44 AM #2
FormPanel children need to be instances of Field. Can you use ComboBox?
-
24 Apr 2008 10:30 AM #3
Yes, I tried, but how can I set the default value from ComboBox.
I tried:
a) call ComboBox: : select(5)
b) call ComboBox: : setValue("MyItemLabel");
c) call ComboBox: : setValue(new CDCBaseModel("MyItemLabel")); where CDCBaseModel extends BaseModel and overrides hashCode() and equals()
but these variants doesn't give any effects.
Because I had this problem, I tried to use ListBox.
(I work with Firefox browser)
-
24 Apr 2008 12:28 PM #4
There were some bugs in setValue for ComboBox. The fix is in SVN and will go out in beta2.
You should pass an existing record from the store or the text that will match value field of a record in the store.


Reply With Quote