Hi Experts,
My requirement is to create a form that has widgets/controls like button,comboBox and textField on it horizontally but i am getting them vertically.
Suggest how can i achieve them vertically.
If i add a HStack on DynamicForm then some of the widgets like comboBox and textBox are not compatible in that situation. Where is the issue lies ?
Code snippet is as:
Browser Version : Chrome 18.0.1025.168 m
SmartGWT Version : 2.5
My requirement is to create a form that has widgets/controls like button,comboBox and textField on it horizontally but i am getting them vertically.
Suggest how can i achieve them vertically.
If i add a HStack on DynamicForm then some of the widgets like comboBox and textBox are not compatible in that situation. Where is the issue lies ?
Code snippet is as:
Code:
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.layout.HStack;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
public class Form extends Canvas {
private DynamicForm dynamicForm;
private Button btnDelete;
private Button btnNewButton;
public Form(){
dynamicForm = new DynamicForm();
dynamicForm.setRedrawOnResize(true);
dynamicForm.setCanDrop(true);
dynamicForm.setCanDragResize(true);
dynamicForm.setCanDragReposition(true);
dynamicForm.setCanDrag(true);
dynamicForm.setCanAddFormulaFields(true);
dynamicForm.setCanAcceptDrop(true);
dynamicForm.setAutoFocus(true);
dynamicForm.setAlign(getHoverAlign());
//CanvasItem canvasItem = new CanvasItem("newCanvasItem_1", "");
btnDelete = new Button("Del");
btnDelete.setSize("50px", "22px");
//canvasItem.setCanvas(btnNewButton);
//dynamicForm.setFields(new FormItem[] { canvasItem});
dynamicForm.addChild(btnDelete);
ComboBoxItem comboBoxItem = new ComboBoxItem("newComboBoxItem_2", "");
CanvasItem canvasItem = new CanvasItem("newCanvasItem_4", "New CanvasItem");
btnNewButton = new Button("Add");
canvasItem.setCanvas(btnNewButton);
dynamicForm.setFields(new FormItem[] { comboBoxItem, new TextItem("newTextItem_3", ""), canvasItem});
addChild(dynamicForm);
dynamicForm.setRect(6, 6, 438, 288);
}
}
SmartGWT Version : 2.5
Comment