Announcement

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

    Layout like 'display online'

    Hi,

    If I place many item(ex. button) in html,
    They are placed horizontaly, It seems below.

    aaa bbb ccc ddd eee fff ggg hhh

    And if windows width chenged to short, some tail items were wraped,
    and It seems below.

    aaa bbb ccc ddd eee
    fff ggg hhh

    Can I create such layout (html word 'display inline') ?

    #2
    Try TileLayout with layoutPolicy of "flow".

    Code:
    tileLayout.setLayoutPolicy(TileLayoutPolicy.FLOW);
    Sanjiv

    Comment


      #3
      Thanks for your reply !

      I tried it.
      Initial placement was good !
      But when I resize the frame, It does not replace lavels.

      Is it something wrong ?

      Code:
      	public void onModuleLoad() {
              Canvas c = new Canvas();
              
              TileLayout tilelayout = new TileLayout();
              tilelayout.setWidth(500);
              tilelayout.setLayoutPolicy(TileLayoutPolicy.FLOW);
              //tilelayout.setTilesPerLine(5);
              //tilelayout.setTileHeight(10);
              //tilelayout.setTileWidth(30);
              tilelayout.setOverflow(Overflow.VISIBLE);
              tilelayout.setAutoWrapLines(true);
              tilelayout.setShowEdges(true);  
              tilelayout.setCanDragResize(true);
              
              for(int i = 0; i < 50; i++){
              	tilelayout.addTile(makeLabel(i));  
              }
              c.addChild(tilelayout);  
              c.draw();  
      	}

      Comment


        #4
        You did not provide the code for your "makeLabel" method. I tried your sample with the makeLabel method returning a simple Canvas with some text. It displays fine. Please explain the behavior you're seeing in detail.

        What do you mean by "But when I resize the frame, It does not replace lavels." What behavior are you looking for. The less information you provide, the less help we're going to be able to provide.

        Sanjiv

        Comment


          #5
          Sorry, Sanjiv.
          It is hard work for me to explain well by my poor English.

          But I try agein.
          The makeLabel code is below.
          It create 2 type width Label.

          Code:
             public Label makeLabel(int i) {
                  Label label = new Label();
                  label.setHeight(10);
                  String s;
                  if(i%2==0){
                      s = "aaaaa"+i;
                  }
                  else{
                      s = "aaaaaaaaaa"+i;
                  }
                  label.setWidth(s.length()*8+2);
                  label.setContents(s);
                  return label;
              }
          Initial showing of the web page appears 1 edged Canvas.
          It seem that The Labels are placed well by TileLayoutPolicy.FLOW.

          I drag the Canvas edge, and resize the Canvas more wider, and release mouse button.
          The Canvas width was changed.
          I wish that the lavels change position for new canvas field.
          But they did not move, sit in the initial place .

          Did I explain well ?

          Comment


            #6
            GWT FlowPanel

            This is just the behavier that I wish .

            GWT FlowPanel
            http://ongwt.googlecode.com/svn/trunk/com.google.gwt.sample.showcase.Showcase/Showcase.html#CwFlowPanel

            Then I am wandering that I create FlowPanel into Canvas and create many GWT InnerLabel into the panel.
            But this way, I have to handle InnerLabel event and style by GWT way, not SmartGWT way.
            I do not want to do so.

            Comment


              #7
              This seems to be a bit related to the problem I mention here:
              http://forums.smartclient.com/showthread.php?t=3775&highlight=html+smartclient

              Once the labels are created, their position is set fixed, so they don't move anymore.

              Comment


                #8
                Just a note that this is fixed in SmartClient now. Not sure if it has hit SVN for SmartGWT yet.

                Comment


                  #9
                  Change is in SVN.

                  Comment

                  Working...
                  X