Hybrid View

  1. #1
    Ext GWT Premium Member
    Join Date
    Dec 2011
    Location
    Earth
    Posts
    243
    Vote Rating
    1
    nbuesing is on a distinguished road

      0  

    Default Have Dialog Resize by content

    Have Dialog Resize by content


    I create a dialog and display it. I close the dialog and before opening again the content changes (so it needs a larger window to display it). However, I can not get the dialog to resize, I must explicitly size it.

    I try doing dialog.forceLayout(), dialog.setPixelSize(-1,-1)/dialog.forceLayout(), etc. Nothing seems to work for me.

    The dialog sizing is as desired the first time, but not the following times.

    What am I missing with the GXT Dialog widget?

    Thanks.



    DialogResizeByContent.zip

  2. #2
    Touch Premium Member
    Join Date
    Mar 2008
    Location
    Morgan Hill, CA
    Posts
    127
    Vote Rating
    3
    margozzi is on a distinguished road

      0  

    Default


    Did you ever get a response? I am having similar issues with my Dialog.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    402
    Vote Rating
    15
    branflake2267 will become famous soon enough

      0  

    Default


    This has been fixed in version GXT 3.0.6.

    After the layout changes call:
    Code:
    autoSize.forceLayout().
    Code:
        finalDialog autoSize = newDialog();    
       autoSize.setBodyBorder(false);
        autoSize.setHeadingText("Auto Size Dialog");
        autoSize.setHideOnButtonClick(true);
        autoSize.setWidget(flc);
        autoSize.addButton(new TextButton("Add", new SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            int widgetCount = flc.getWidgetCount();
            StringBuilder s = new StringBuilder(widgetCount);
            for (int i = 0; i < widgetCount; i++) {
              s.append(" *");
            }
            flc.add(new HTML(new Date().toString() + s));
            autoSize.forceLayout();
          }
        }));
        autoSize.addButton(new TextButton("Remove", new SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            int lastWidget = flc.getWidgetCount() - 1;
            if (lastWidget > 0) {
              flc.remove(lastWidget);
              autoSize.forceLayout();
            }
          }
        }));
        autoSize.setPixelSize(-1, -1);
        autoSize.setMinWidth(0);
        autoSize.setMinHeight(0);
        autoSize.setResizable(false);
        autoSize.setShadow(false);

  4. #4
    Touch Premium Member
    Join Date
    Mar 2008
    Location
    Morgan Hill, CA
    Posts
    127
    Vote Rating
    3
    margozzi is on a distinguished road

      0  

    Default


    Thank you, that seems to mostly work.

    Couple of things:
    • The docs for setShadow() say that it defaults to false, however, if I omit that line, the shadow is there.
    • setMinWidth() and setMinHeight() say they only apply when resizable is true. So why do we have to set them? Or do the docs need improving?
    • The dialog buttons no longer are right aligned for me. I even added the call to align them to the end and still they are left aligned. What is going on there? setButtonAlign(BoxLayoutPack.END);

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    402
    Vote Rating
    15
    branflake2267 will become famous soon enough

      0  

    Default


    I'll have to look into the docs and defaults. Although the dialog right alignment for 3.0.6 when autosize is on has an issue and a bug is filed for that.

Thread Participants: 2