using TileLayout

Below code, the initial show of TileLayout is wrong.
Many lavels are overlapping .
Once I resized canvas, all labels queue up well.

If I do not use label.setAutoWidth(), everythng is OK.

public void onModuleLoad(){
    Canvas c = new Canvas();
    c.setSize("100%", "100%");
    TileLayout tile = new TileLayout();
    tile.setSize("100%", "100%");
    tile.setLayoutPolicy(TileLayoutPolicy.FLOW);
    tile.setOverflow(Overflow.VISIBLE);
    tile.setAutoWrapLines(true);
    tile.setShowEdges(true);  
    for(int i = 0; i < 50; i++){
        Label label = new Label();
        label.setContents("aaaaaaaaa"+i);
        label.setAutoWidth();
        label.setAutoHeight();
        tile.addTile(label);
    }
    c.addChild(tile);  
    c.draw();  
}

Hi ji-ta,

Are you using the latest from SVN?

If you are, and you think it’s a bug, can you make this into a standalone test case?

Hi Isomorphic,

I am using must newest revision.384 .
http://smartgwt.build.rorschach.de/

“into a standalone test case?”,
You mean, try tileLayaut be top level ?
If so, I try, everything is same.

Initial layout, the lavels are overlapping each other, shifting some pixels, lavels are on 1 line.
HostedMode, WebMode(Firefox, GoogleChrome, IE) same.
But Once I changed browser width, 50 labels are layouted correctly.

public void onModuleLoad(){
    TileLayout tile = new TileLayout();
    tile.setSize("100%", "100%");
    tile.setLayoutPolicy(TileLayoutPolicy.FLOW);
    tile.setOverflow(Overflow.VISIBLE);
    tile.setAutoWrapLines(true);
    tile.setShowEdges(true);  
    for(int i = 0; i < 50; i++){
        Label label = new Label();
        label.setContents("aaaaaaaaa"+i);
        label.setAutoWidth();
        label.setAutoHeight();
        tile.addTile(label);
    }
     tile.draw();  
}

I ran your sample. Label.setAutoWidth() it is interfering with the layout. If you remove it, it displays fine however the width of each tile is fixed. I’ve added a method TileGrid.layoutMembers() which you can call after drawing the TileGrid. Note that this method is subject to change / removal once your original testcase is handled.

Sanjiv

Sanjiv add a API named TileLayout.layoutTiles() .
Thanks Sanjiv .

For japanese strings , there is more information …
http://forums.smartclient.com/showthread.php?t=4797