MinWidth and width100

Hi,

I’m unable to get both of these working together. I have a HLayout with width set to 100%, and I want it to stop reducing in size when the browser window reaches its minWidth value. But it just continues shrinking.

Has anybody got an idea how to solve it? Stand-alone test case follows:

Thanks in advance,
Alan

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class Test3 implements EntryPoint {

    VLayout left, right;

    public Test3() {
    }

    public void onModuleLoad() {
        left = new VLayout();
        left.setWidth("60%");
        left.setHeight100();
        left.setBorder("2px dashed red");
        left.setBackgroundColor("#ccc");

        right = new VLayout();
        right.setWidth("40%");
        right.setHeight100();
        right.setBorder("2px dashed red");
        right.setBackgroundColor("#aaa");

        HLayout t = new HLayout();
        t.setWidth100();
        t.setHeight100();
        //Min-width Doesn't work:
        t.setMinWidth(1000);
        t.addMember(left);
        t.addMember(right);
        t.setBorder("2px dashed green");
        t.setBackgroundColor("white");
        t.draw();
    }
}

Is there no way to give a Layout a minWidth? Any help would be greatly appreciated.

thanks

I don’t know, why minWidth doesn’t work, and if you don’t find a better solution, I suggest the following workaround:

package com.example.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class Test3 implements EntryPoint {
    VLayout left, right;

    public void onModuleLoad() {
        left = new VLayout();
        left.setWidth("60%");
        left.setHeight100();
        left.setBorder("2px dashed red");
        left.setBackgroundColor("#ccc");
        
        Label leftMinWidthEnforceLabel = new Label();
        leftMinWidthEnforceLabel.setWidth(600);
        leftMinWidthEnforceLabel.setHeight(1);
        left.addMember(leftMinWidthEnforceLabel);

        right = new VLayout();
        right.setWidth("40%");
        right.setHeight100();
        right.setBorder("2px dashed red");
        right.setBackgroundColor("#aaa");

        Label rightMinWidthEnforceLabel = new Label();
        rightMinWidthEnforceLabel.setWidth(400);
        rightMinWidthEnforceLabel.setHeight(1);
        right.addMember(rightMinWidthEnforceLabel);

        HLayout t = new HLayout();
        t.setWidth100();
        t.setHeight100();
        //Min-width Doesn't work:
        t.setMinWidth(1000);
        t.addMember(left);
        t.addMember(right);
        t.setBorder("2px dashed green");
        t.setBackgroundColor("white");
        t.draw();
    }

}

I have the same issue and it’s frustrating putting labels with minwidth in every layout, isn´t another way to accomplish this?

Hi , actually this was my problem too but i found the solution …

Isophormic recommend to use 3.0 branch , and i use it and it will work fine

u can see this issue http://forums.smartclient.com/showthread.php?t=19214