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

Juan Vuletich juan at cuis.st
Mon Aug 12 05:57:31 PDT 2024


On 8/11/2024 11:26 AM, ken.dickey--- via Cuis-dev wrote:
> On 2024-08-11 06:42, Mark Volkmann via Cuis-dev wrote:
>
>> My current use case is that I have a list of todo items. When a new 
>> todo is added, I want it to appear at the beginning of the list.
>
> Hey, how hard can it be?
>
> ;^)
> -KenD
> vvv===vvv===vvv
> addMorphTopOrLeft: aMorph
>   "Add a submorph, at the top or left, with a default LayoutSpec if 
> none was provided."
>
>   aMorph isPlacedMorph ifFalse: [ self error: 'Only PlacedMorphs can 
> be used in Layouts' ].
>     aMorph layoutSpec.
>     super addMorphBack: aMorph.
>     self layoutSubmorphs
> ^^^===^^^===^^^

Thanks Ken. I pushed this to GitHub, but I preferred to call it 
#addMorphBack:. It is consistent with the rest of the protocol in 
LayoutMorph, and the idea that by default #addMorph: adds the new Morph 
"on top", and "last" (i.e. right/bottom in LayoutMorphs).

Thanks,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list