Announcement

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

    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


    Code:
    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();
        }
    }

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

    thanks

    Comment


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

      Code:
      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();
          }
      
      }

      Comment


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

        Comment


          #5
          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

          Comment

          Working...
          X