Announcement

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

    Problem with Floating ButtonItem in DynamicForm set inside Tab

    A buttonItem set in a DynamicForm which is set in a tab loses its absolute position in the form when the tab is re-used. At initialization the ButtonItem is in the correct place, but subsequent uses of the tab cause the ButtoneItem to float to upper left corner - 0,0 for absolute positioning.

    1. the SmartGWT 2.5


    2. Developer Console - SmartClient Version: SC_SNAPSHOT-2011-07-12/Pro Deployment (built 2011-07-12)


    3. DynamicForm df = new DynamicForm();
    df.setItemLayout(FormLayoutType.ABSOLUTE);
    Button buttonOne = new Button();
    buttonOne.setTop(20);
    buttonOne.setLeft(100);
    setWidth(40);
    df.addChild(buttonOne);

    Posts with incomplete information are much more likely to be ignored.

    #2
    How do you reproduce this? Your code doesn't, and you mention a tab and a ButtonItem, but you use neither. You also omitted browser and mode and other details.

    Comment


      #3
      DynamicForm df1 = new DynamicForm();
      df1.setItemLayout(FormLayoutType.ABSOLUTE);
      Button buttonOne = new Button();
      buttonOne.setTop(20);
      buttonOne.setLeft(100);
      setWidth(40);
      df1.addChild(buttonOne);

      df1.setItemLayout(FormLayoutType.ABSOLUTE);
      Button buttonOne = new Button();
      buttonOne.setTop(20);
      buttonOne.setLeft(100);
      setWidth(40);
      df1.addChild(buttonOne);

      LinkedHashMap<String, Canvas> ewForms = new LinkedHashMap<String, Canvas>();
      ewForms.put("DFOne", df1);
      ewForms.put("OtherForm", otherForm);

      ----


      for (String key : ewCanvasMap.keySet()) {
      Layout tabLayout = new VLayout();
      tabLayout.setMargin(20);
      tabLayout.setMembersMargin(15);
      tabLayout.addMember(ewCanvasMap.get(key));
      if (ewCanvasMap.get(key) instanceof DynamicForm) {
      ((DynamicForm) ewCanvasMap.get(key)).setWrapItemTitles(false);
      }

      Tab ewTab = new Tab(key);
      ewTab.setID(pageBaseId + "_tab" + tabIterator);
      ewTab.setPane(tabLayout);
      ewTabSet.addTab(ewTab);

      Comment


        #4
        Thanks - please test with a fully patched version (see smartclient.com/builds). Also, please indicate browser(s) where this is reproducible.

        Comment


          #5
          After updating to the 01.05.2012 SmartGWT Pro 2.5 Build the problem was corrected. Thank you!

          Comment


            #6
            This problem is back in 3.1d. Appears to only affect Firefox (all versions), Safari doesn't exhibit this problem. I am on OSX. It seems to only affect ButtonItem and CanvasItem and only when inside a TabSet.

            Initial rendering of the form containing above stated elements is fine but as soon I switch focus to a different Tab or hide entire TabSet and then go back to the one with the form, ButtonItem and CanvasItem items get reset to 0,0 coordinates.

            I tried both Absolute and Relative layout of the DynamicForm - end result is the same.

            To work around, I added form.redraw() which repositions shifted items into place. redraw() is inside an onTabSelected() handler. But that's just not clean. This work around only works for RELATIVE layout.

            Comment


              #7
              Can you indicate your exact version, and show runnable code that reproduces the problem?

              Note the previously posted code wasn't a valid test case - it was just enough for us to be pretty sure it was an already-fixed bug.

              Comment

              Working...
              X