Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Exception when drawing form with hidden canvasItem

$
0
0
Hi,

I have a system where I change the contents of a pane for a tab depending on user action.

In one case, I want to go to a UI with a form containing a canvasItem that wraps another form. Initially, I want the canvasItem to be hidden.

When displaying the form, I get the following warning:

Code:

4:27:08.291:MUP8[E]:WARN:drawing:isc_DynamicForm_0:negative or zero area: height: 20, width: 0, refusing to draw
    Canvas.readyToDraw()
    DynamicForm.draw(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
    CanvasItem.sizeCanvas(_1=>true)
    CanvasItem.checkCanvasOverflow()
    DynamicForm.getInnerHTML(_1=>completeInnerHTMLFun())
    anonymous()
    anonymous(thisObj=>DynamicForm{fields: Array[3],
ID: "isc_DynamicForm_1",
position: "absolute",
className: "normal",
width: 690,
height: 20,
top: -9999,
items: Array[3],
values: Obj,
originalFields: Array[3],
children: Array[1],
tabIndex: 1268,
errors: Obj,
parentElement: [VLayout ID:isc_VLayout_2],
topElement: [VLayout ID:isc_VLayout_1],
cacheOffsetCoords: true,
zIndex: 200216,
}, dispId=>1180125)
    anonymous(completeInnerHTMLFun())
    Canvas.$px(_1=>undef)
    Canvas.$p9()
    Canvas.draw(_1=>undef, undef, undef, undef, undef, undef, undef, undef, undef, undef)
    [a]MathFunction.invokeSuper(_1=>[Class DynamicForm], _2=>"draw", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
    ** recursed on DynamicForm.draw

14:27:08.305:MUP8[E]:WARN:drawing:isc_DynamicForm_0:negative or zero area: height: 20, width: 0, refusing to draw
    Canvas.readyToDraw()
    DynamicForm.draw(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
    Canvas.drawChildren()
    Canvas.draw(_1=>undef, undef, undef, undef, undef, undef, undef, undef, undef, undef)
    [a]MathFunction.invokeSuper(_1=>[Class DynamicForm], _2=>"draw", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
    ** recursed on DynamicForm.draw

A test case that illustrates this problem:

Code:

        VLayout l = new VLayout();
        l.setWidth(700);
        l.setHeight(700);
        final VLayout canvas1 = new VLayout();
        final VLayout canvas2 = new VLayout();
        final TabSet tabs = new TabSet();
        Tab tab1 = new Tab("Tab1");
        tab1.setPane(canvas2);
        tabs.addTab(tab1);
        tabs.setWidth100();
        tabs.setHeight100();

        final DynamicForm form = new DynamicForm();
        CanvasItem ci = new CanvasItem("Address","Address");
        DynamicForm subForm = new DynamicForm();
        subForm.setWidth100();
        subForm.setFields(new TextItem("Street"), new TextItem("City"));
        subForm.setGroupTitle("My subform");
        subForm.setNumCols(4);
        subForm.setColWidths("25%","25%","25%","25%");
        ci.setCanvas(subForm);
        form.setFields(new TextItem("Name"), ci, new TextItem("Phone"));

        Button btn1 = new Button("Go back");
        btn1.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                tabs.updateTab(0,canvas2);
            }
        });

        Button btn2 = new Button("Go");
        btn2.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                form.getField("Address").hide();
                tabs.updateTab(0,canvas1);
            }
        });
        canvas2.addMember(new Label("From here I want to go to the form with the Street/City subform hidden"));
        canvas2.addMember(btn2);

        canvas1.addMember(form);
        canvas1.addMember(btn1);
        l.addMember(tabs);
        l.draw();

SmartGwt Power 20140622

Regards
Rolf

Viewing all articles
Browse latest Browse all 4756

Trending Articles