-
3 Sep 2008 10:28 AM #1
Confused about FormPanel and nested containers...
Confused about FormPanel and nested containers...
The JavaDoc on FormPanel says the following:
"FormPanel supports nested layout containers."
But it doesn't really... You have to use AdapterField or MultiField to nest anything, right?
It took me a while to figure this out as there seems to be absolutely no documentation or example of this anywhere.
Or am I missing some more direct way to nest containers in a form?
...
Also, is the only way to hide the label on a field to add a style to it? This seems very awkward... why not simply have a hideLabel() method on field?
thanks,
Pat
-
11 Sep 2008 12:18 PM #2
I have added some info in the javadocs about only using fields with a form layout. Also, in 1.1 you can hide the labels of fields. See the screen shot of a form using anchor positioning. The text area is hiding its label.
Code:public AnchorLayoutExample() { setLayout(new FlowLayout(10)); final Window w = new Window(); w.setPlain(true); w.setSize(500, 300); w.setHeading("Resize Me"); w.setLayout(new FitLayout()); FormPanel panel = new FormPanel(); panel.setBorders(false); panel.setBodyBorder(false); panel.setLabelWidth(55); panel.setHeaderVisible(false); TextField<String> field = new TextField<String>(); field.setFieldLabel("Sent To"); panel.add(field, new FormData("100%")); field = new TextField<String>(); field.setFieldLabel("Subject"); panel.add(field, new FormData("100%")); TextArea area = new TextArea(); area.setHideLabel(true); panel.add(area, new FormData("100% -53")); w.addButton(new Button("Send")); w.addButton(new Button("Cancel")); w.add(panel); Button b = new Button("Open", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { w.show(); } }); add(b); }
-
13 Sep 2008 5:28 PM #3
FormData constructor in 1.0.4
FormData constructor in 1.0.4
Great example and I'm trying to apply it, but:
I'm using version 1.0.4 and I didn't find the FormData constructor used in your example, which allows the width to be passed as a string. I found the constructors bellow
FormData(int width, int height);
FormData();
Was it removed from this version?
Actually I found the string arg interesting when passing it as "100%" and resizing the dialog window the control size is automatically adjusted.
Regards,
Ricardo
-
13 Sep 2008 6:35 PM #4
darrell's example is based on 1.1 in svn


Reply With Quote