Announcement

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

    The height of DynamicForm with wrapping item titles

    Hello,

    We have a simple DynamicForm with a set of fields at the top and a rich text area at the bottom. The text area at the bottom is configured to "fill" the viewport by setting its size as "*". It seems, that if the titles of the fields at the top wrap, the height of the total form is calculated wrong.

    This is demonstrated by this test case:

    Code:
        public void doOnModuleLoad() {
            viewport = new VLayout();
            viewport.setWidth(500);
            viewport.setHeight(600);
            viewport.setBackgroundColor("blue");
            viewport.setOverflow(Overflow.AUTO);
    
            final DynamicForm form = new DynamicForm();
            form.setHeight100();
            form.setBackgroundColor("red");
    
            List<FormItem> fields = new ArrayList<>();
            for(int i=0; i<10; i++) {
                String title = "title with wrapping very long wrapping text";
                fields.add(new TextItem("" + i, title + " " + i));
            }
    
            TextAreaItem tai = new TextAreaItem("tai", "text area");
            tai.setTitleOrientation(TitleOrientation.TOP);
            tai.setWidth("*");
            tai.setHeight("*");
            tai.setColSpan(2);
            fields.add(tai);
    
            form.setFields(fields.toArray(new FormItem[0]));
    
            Button fb = new Button("fix");
            fb.addClickHandler(clickEvent -> {
                for(int i=0; i<10; i++) {
                    form.getField("" + i).setTitle("title " + i);
                }
                form.markForRedraw();
            });
    
            Button bb = new Button("break");
            bb.addClickHandler(clickEvent -> {
                for(int i=0; i<10; i++) {
                    form.getField("" + i).setTitle("title with wrapping very long wrapping text " + i);
                }
                form.markForRedraw();
            });
    
            HStack bs = new HStack();
            bs.setMembers(fb, bb);
    
            viewport.addMember(form);
            viewport.addMember(bs);
            viewport.draw();
        }
    How to reproduce: When initially drawn, see that the scrollbar gets drawn as the form's height overflows. Scroll the viewport to the bottom, click "fix" and see that as the titles do not overflow, the fields are fit correctly to the remaining space. Clicking "break" will again, draw the form with overflowing height.

    Is this something that should work as it is or is our only avenue to fix this to configure the item titles to not to wrap?

    Using SmartClient Version: v13.0p_2022-02-02/LGPL Development Only (built 2022-02-02).


    #2
    Thanks for the report - this is a bug and is assigned to be looked at shortly - we'll update here when it's been fixed.

    Comment

    Working...
    X