baskor
15 Jun 2009, 12:45 AM
Hi
I want to create a multifield that contains two buttons, and I want the buttons to be right aligned. How can I do this. I've tried all sorts of things without luck.
Alternatively I want the buttons to fill the width 100%. Here is some code, where I have tried this (also without luck)
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.*;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class Test implements EntryPoint {
public void onModuleLoad() {
Viewport vp = new Viewport();
FormPanel form = new FormPanel();
TextField<String> text = new TextField<String>();
text.setFieldLabel("Some Text");
form.add(text, new FormData("100%"));
MultiField<Field> groupButtons = new MultiField<Field>();
groupButtons.setAutoWidth(true);
groupButtons.setLabelSeparator("");
Button addBtn = new Button("Add");
AdapterField addBtnAdapter = new AdapterField(addBtn);
addBtnAdapter.setAutoWidth(true);
groupButtons.add(addBtnAdapter);
Button removeBtn = new Button("Remove");
AdapterField removeBtnAdapter = new AdapterField(removeBtn);
removeBtnAdapter.setAutoWidth(true);
groupButtons.add(removeBtnAdapter);
form.add(groupButtons, new FormData("100%"));
vp.add(form);
RootPanel.get().add(vp);
}
}
I want to create a multifield that contains two buttons, and I want the buttons to be right aligned. How can I do this. I've tried all sorts of things without luck.
Alternatively I want the buttons to fill the width 100%. Here is some code, where I have tried this (also without luck)
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.*;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class Test implements EntryPoint {
public void onModuleLoad() {
Viewport vp = new Viewport();
FormPanel form = new FormPanel();
TextField<String> text = new TextField<String>();
text.setFieldLabel("Some Text");
form.add(text, new FormData("100%"));
MultiField<Field> groupButtons = new MultiField<Field>();
groupButtons.setAutoWidth(true);
groupButtons.setLabelSeparator("");
Button addBtn = new Button("Add");
AdapterField addBtnAdapter = new AdapterField(addBtn);
addBtnAdapter.setAutoWidth(true);
groupButtons.add(addBtnAdapter);
Button removeBtn = new Button("Remove");
AdapterField removeBtnAdapter = new AdapterField(removeBtn);
removeBtnAdapter.setAutoWidth(true);
groupButtons.add(removeBtnAdapter);
form.add(groupButtons, new FormData("100%"));
vp.add(form);
RootPanel.get().add(vp);
}
}