Announcement

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

    ButtonItem colspan

    smartgwt-3.1d

    Try as I might I can't manage to get multiple ButtonItems to span multiple columns on one row in the form. The code does put the buttons on one row, but it won't span multiple columns - it puts the 1st button in column 1 and the 2nd in column 2. See attached.

    I know that I can create a HLayout and put the IButtons there, but that's not the "right way" to do it (IMHO) - especially if the button row is in the middle of the form.

    Thanks

    ButtonItem build = new ButtonItem("Build");
    //build.setColSpan(2);
    build.setWidth(75);
    build.setAlign(Alignment.RIGHT);
    build.setEndRow(false);

    ButtonItem invoke = new ButtonItem("Invoke");
    //invoke.setColSpan(2);
    invoke.setWidth(75);
    invoke.setAlign(Alignment.RIGHT);
    invoke.setStartRow(false);
    invoke.setEndRow(true);
    Attached Files

    #2
    You appear to only have 2 columns, so a colSpan:2 button is just going to complete the row and push the next button onto another line. See the FormLayout overview for background.

    Comment


      #3
      I have read the FormLayout overview more than once but I still don't have a solution. I mentioned column span because I need the buttons to span all columns and be right justified - which is a fairly typical look (see desired.png). This is a case of just 2 buttons, but obviously there are uses cases for a whole bunch on one row.

      Thanks.
      Attached Files

      Comment


        #4
        Your desired look shows the buttons not fitting in any particular column. For this, use a ToolbarItem that spans the remaining columns.

        You could also use an HStack of buttons either combined with the form via a VLayout or embedded in the form via a CanvasItem.

        Comment


          #5
          Much closer - with ToolbarItem! If you look at attached, the buttons to span the 2 columns, however, the buttons aren't right justified. BTW, I ran this will the nightly build for 3.1d and 4.0d

          IButton build = new IButton("Build");
          build.setWidth(75);

          IButton invoke = new IButton("Invoke");
          invoke.setWidth(75);

          ToolbarItem tool = new ToolbarItem();
          tool.setColSpan(2);
          tool.setAlign(Alignment.RIGHT);
          tool.setButtons(build, invoke);

          form.setItems(name, dbType, desc, share, save, login, pass, tool);
          Attached Files
          Last edited by sbusch; 18 Sep 2012, 12:40.

          Comment

          Working...
          X