Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to Top-Align ButtonItem with CanvasItem in DynamicForm

    Need a 2 col form with button on left and canvasitem on right.

    I want button aligned to the top of the canvas.

    My best efforts have failed.

    This code example leaves the buttonitem aligned with the center horizontal axis of the Canvas; rather than the top.



    Code:
    		/* The button */
    		ButtonItem button = new ButtonItem();
    		button.setTitle("button");
    		button.setShowTitle(false);
    		button.setAutoFit(true);
    		button.setEndRow(false);
    						
    		/* panel to top-align the button to */
    		TileLayout layout = new TileLayout();
    		layout.setHeight(200);
    		layout.setWidth(200);
    		layout.setBorder("solid"); //so we can see the panel
    		
    		CanvasItem pnlWrapper = new CanvasItem();
    		pnlWrapper.setCanvas(layout);
    		pnlWrapper.setShowTitle(false);
    		
    
    		/* The form to contain them */
    		DynamicForm form = new DynamicForm();
    		form.setItems(button, pnlWrapper);
    		form.setNumCols(2);
    		
    
    		// display the form
    		HLayout hl = new HLayout();
    		hl.addMember(form);
    		RootPanel.get().add(form);
Working...
X