strange behavior in the layout with WrapDirection attribute

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

strange behavior in the layout with WrapDirection attribute

Hilaire Fernandes-3
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@500;
     layoutPolicy: TableLayout new;
     listDirection: #topToBottom;
     layoutInset: 10; cellInset: 10;
     addMorphBack: submorph;
     addMorphBack: (Morph new color: Color orange;
         vResizing: #spaceFill;
         hResizing: #spaceFill)) openInWorld


Reply | Threaded
Open this post in threaded view
|

Re: strange behavior in the layout with WrapDirection attribute

karl-8
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@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@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


Reply | Threaded
Open this post in threaded view
|

Re: strange behavior in the layout with WrapDirection attribute

Hilaire Fernandes-3
I will try to apply your hack to my situation.

Thanks

Hilaire

karl a écrit :
> 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...



Reply | Threaded
Open this post in threaded view
|

Re: strange behavior in the layout with WrapDirection attribute

Hilaire Fernandes-3
Hilaire Fernandes a écrit :

> I will try to apply your hack to my situation.
>
> Thanks
>
> Hilaire
>
> karl a écrit :
>> 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...


The "World doOnCycle" can do some miracle, thanks for the tip.
However it forces to do some tricks in the code.

Hilaire