[Cuis-dev] adding a morph to start of LayoutMorph

Mariano Montone marianomontone at gmail.com
Sat Aug 10 05:13:40 PDT 2024


I think you may have spotted a bug. From what I observe, LayoutMorph 
does not layout its children properly after a submorph is added at front 
position (the added submorph is layed out as if it were the last submorph).

El 10/8/24 a las 08:40, Mark Volkmann via Cuis-dev escribió:
> On Fri, Aug 9, 2024 at 7:54 PM Mark Volkmann 
> <r.mark.volkmann at gmail.com> wrote:
>
>     I want to add a morph as the first submorph in a LayoutMorph that
>     already has submorphs.
>     I thought the addMorphFront: method would do that, but it doesn't.
>     This code seems surprising:
>
>     lm := LayoutMorph newColumn openInWorld.
>     lm addMorph: (LabelMorph new contents: 'one').
>     lm addMorph: (LabelMorph new contents: 'two').
>     first := lm submorphs first.
>
>     first will be set to the LabelMorph whose content is 'two', not 'one'.
>
>     Is there a way to add a morph to the beginning of a LayoutMorph?
>
>
> I see now that sending #addMorphFront: does add a morph to the 
> beginning of the submorphs array, but the parent morph does not 
> automatically redraw itself. Sending #redrawNeeded to the parent does 
> not force it to redraw using the updated submorphs array. What can I 
> do to force that?
>
> -- 
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240810/b26dfe9e/attachment.htm>


More information about the Cuis-dev mailing list