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

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sun Aug 11 07:26:17 PDT 2024


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
^^^===^^^===^^^
-------------- next part --------------
'From Cuis7.1 [latest update: #6566] on 11 August 2024 at 7:23:18 am'!

!LayoutMorph methodsFor: 'submorphs-add/remove' stamp: 'KenD 8/11/2024 07:22:55'!
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! !


More information about the Cuis-dev mailing list