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

Mark Volkmann r.mark.volkmann at gmail.com
Sat Aug 10 04:40:37 PDT 2024


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/4e485e82/attachment.htm>


More information about the Cuis-dev mailing list