Announcement

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

    Resizing of layout

    Hi Isomorphic,

    I have problems with resizing of layout. INHO it should work this way, but it doesn't work. Am I missing something?

    SmartClient Version: v12.0p_2019-12-04/PowerEdition Deployment (built 2019-12-04)


    Click image for larger version  Name:	setCanDragResize.gif Views:	0 Size:	36.0 KB ID:	260310


    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.types.Alignment;
    import com.smartgwt.client.types.Cursor;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.Img;
    import com.smartgwt.client.widgets.Label;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.smartgwt.client.widgets.layout.VStack;
    
    public class BuiltInDS extends VLayout implements EntryPoint {
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            setWidth100();
            setHeight100();
    
            VStack iconPlusLabel = new VStack(2) {
                {
                    setHeight(72);
                    setStyleName("menuButtonMouseNormal");
                    HLayout hL = new HLayout(0) {
                        {
                            Img img = new Img("http://127.0.0.1:8888/builtinds/sc/skins/Enterprise/images/DynamicForm/search_icon.svg", 48, 48);
                            // Img img = new Img("http://127.0.0.1:8888/builtinds/sc/skins/Enterprise/images/DynamicForm/search_icon~2.png", 48, 48);
                            img.setCursor(Cursor.HAND);
                            setHeight(48);
                            setWidth(190);
                            setAlign(Alignment.CENTER);
                            setMembers(img);
                        }
                    };
                    Label label = new Label("Label title") {
                        {
                            setHeight(20);
                            setAlign(Alignment.CENTER);
                            setCursor(Cursor.HAND);
                        }
                    };
    
                    setMembers(hL, label);
                }
            };
    
            VLayout vL = new VLayout();
            vL.setAlign(Alignment.CENTER);
            vL.setShowEdges(true);
            vL.setCanDragResize(true);
            vL.setHeight(300);
            vL.setWidth(300);
    
            vL.setMembers(iconPlusLabel);
    
            setMembers(vL);
            draw();
        }
    }
    Best regards
    Pavo
    Last edited by pavo123; 6 Dec 2019, 05:04.

    #2
    You haven't said what you actually want - please remember that this is a critical part of any request for help.

    As a guess, maybe you want the text to be centered. If so, see canvas.layoutAlign.

    Comment


      #3
      Hi Isomorphic,

      I was trying to hide "iconPlusLabel".
      The label moves to the left, the icon always stays in the same place.
      That's not logical in my opinion.

      Best regards
      Pavo

      Comment


        #4
        We're having trouble understand you..

        It seems as if we've already told you the setting that would get what you want, and the framework is behaving in accordance with the documentation.

        Are we missing something?

        Comment


          #5
          Hi Isomorphic,

          my intention is that both layouts have the same width after changing it.

          Click image for larger version  Name:	canDragResize.gif Views:	0 Size:	66.7 KB ID:	260351

          The second layout (this one below) cannot reduce the width to be the same as for the first layout(this one above).

          The width of the second (below) layout cannot be less that 202, even though "canDragResize:true".
          If this is ok according to docs, sorry, my fault.

          Code:
          package com.smartgwt.sample.client;
          
          import com.google.gwt.core.client.EntryPoint;
          import com.smartgwt.client.core.KeyIdentifier;
          import com.smartgwt.client.types.Alignment;
          import com.smartgwt.client.types.Cursor;
          import com.smartgwt.client.util.Page;
          import com.smartgwt.client.util.PageKeyHandler;
          import com.smartgwt.client.util.SC;
          import com.smartgwt.client.widgets.Img;
          import com.smartgwt.client.widgets.Label;
          import com.smartgwt.client.widgets.layout.HLayout;
          import com.smartgwt.client.widgets.layout.VLayout;
          import com.smartgwt.client.widgets.layout.VStack;
          
          public class BuiltInDS extends VLayout implements EntryPoint {
              public void onModuleLoad() {
                  KeyIdentifier debugKey = new KeyIdentifier();
                  debugKey.setCtrlKey(true);
                  debugKey.setKeyName("D");
          
                  Page.registerKey(debugKey, new PageKeyHandler() {
                      public void execute(String keyName) {
                          SC.showConsole();
                      }
                  });
          
                  setWidth100();
                  setHeight100();
          
                  VStack iconPlusLabel = new VStack(2) {
                      {
                          setHeight(72);
                          setStyleName("menuButtonMouseNormal");
                          HLayout hL = new HLayout(0) {
                              {
                                  Img img = new Img("http://127.0.0.1:8888/builtinds/sc/skins/Enterprise/images/DynamicForm/search_icon.svg", 48, 48);
                                  // Img img = new Img("http://127.0.0.1:8888/builtinds/sc/skins/Enterprise/images/DynamicForm/search_icon~2.png", 48, 48);
                                  img.setCursor(Cursor.HAND);
                                  setHeight(48);
                                  setWidth(190);
                                  setAlign(Alignment.CENTER);
                                  setMembers(img);
                              }
                          };
                          Label label = new Label("Label title") {
                              {
                                  setHeight(20);
                                  setAlign(Alignment.CENTER);
                                  setCursor(Cursor.HAND);
                                  setLayoutAlign(Alignment.CENTER);
                              }
                          };
          
                          setMembers(hL, label);
                      }
                  };
          
                  VLayout vl1 = new CustomVLayout();
          
                  VLayout vL2 = new CustomVLayout();
                  vL2.setMembers(iconPlusLabel);
          
                  setMembers(vl1, vL2);
                  draw();
              }
          
              private class CustomVLayout extends VLayout {
                  public CustomVLayout() {
                      setAlign(Alignment.CENTER);
                      setShowEdges(true);
                      setCanDragResize(true);
                      setHeight(300);
                      setWidth(300);
                  }
              }
          }
          Best regards
          Pavo
          Last edited by pavo123; 9 Dec 2019, 06:59.

          Comment


            #6
            Layouts are overflow:visible by default, so they will not clip their contents. See canvas.overflow.

            Comment

            Working...
            X