strange behavior in the layout with WrapDirection attribute

karl karl.ramberg at chello.se
Thu Dec 14 14:43:11 UTC 2006


Hilaire Fernandes skrev:
> I have found the following example to not work as expected.
> The problem seems to come from the wrapDirection.
>
> In this exemple if you resize the morph, the layout is refresh correctly.
>
> I badly need it to work as expected
>
>
> submorph := Morph new color: Color red;
>     layoutPolicy: TableLayout new;
>     listDirection: #leftToRight;
>     cellInset: 10;
>     vResizing: #shrinkWrap;
>     hResizing: #spaceFill;
>     wrapDirection: #topToBottom.
> 10 timesRepeat: [submorph addMorph: Morph new].
> (Morph new color: Color yellow; extent: 300 at 500;
>     layoutPolicy: TableLayout new;
>     listDirection: #topToBottom;
>     layoutInset: 10; cellInset: 10;
>     addMorphBack: submorph;
>     addMorphBack: (Morph new color: Color orange;
>         vResizing: #spaceFill;
>         hResizing: #spaceFill)) openInWorld
>
>
>
Here is a hack. I think there could be an issue with lazy 
initiallization in some layout routine that must forced trough a draw 
before it works...
submorph := Morph new color: Color red;
    layoutPolicy: TableLayout new;
    listDirection: #leftToRight;
    cellInset: 10;
    vResizing: #shrinkWrap;
    hResizing: #spaceFill;
    wrapDirection: #topToBottom.
10 timesRepeat: [submorph addMorph: Morph new].
morph_ Morph new openInWorld.
morph color: Color yellow; extent: 300 at 500;
    layoutPolicy: TableLayout new;
    listDirection: #topToBottom;
    layoutInset: 10; cellInset: 10;
    addMorphBack: submorph.
   morph addMorphBack: (Morph new color: Color orange;
        vResizing: #spaceFill;
        hResizing: #spaceFill).
World doOneCycle.
morph layoutChanged.

karl




More information about the Squeak-dev mailing list