[Cuis-dev] BoxedMorph padding

ken.dickey at whidbey.com ken.dickey at whidbey.com
Fri Sep 6 05:48:37 PDT 2024


Ah! I see that I also forgot the minimumExtent update change (attached).

Your example should now work as follows:

vvv===vvv===vvv

labelMorph := LabelMorph new
     borderWidth: 2;
     borderColor: Color red;
     color: Color cyan;
     padding: 0.

imageMorph := ImageMorph new
     borderWidth: 2;
     borderColor: Color red;
     padding: 0.

layoutMorph := LayoutMorph newColumn
     borderWidth: 2;
     borderColor: Color yellow;
     padding: 0;
     useEdgeSpace: false;
     separation: 0;
     addMorph: labelMorph;
     addMorph: imageMorph;
     scaleBy: 3;
     openInWorld.

labelMorph padding: 3.
imageMorph padding: 3.
layoutMorph padding: 3.

layoutMorph padding: 0; morphExtent: layoutMorph minimumExtent.
layoutMorph separation: 3.

^^^===^^^===^^^

Again, thanks for taking the time..
-KenD
-------------- next part --------------
'From Cuis7.1 [latest update: #6677] on 6 September 2024 at 5:43:54 am'!

!BoxedMorph methodsFor: 'geometry' stamp: 'KenD 9/6/2024 05:40:19'!
minimumExtent
	"This returns the minimum extent that the morph may be shrunk to.
	It is expressed in the morph own coordinates, like morphExtent."

	^ super minimumExtent + (self padding + self borderWidth * 2)! !


!BoxedMorph methodsFor: 'accessing' stamp: 'KenD 9/6/2024 05:40:24'!
padding: numberOrPoint
	"Save a point"
	self flag: #FakeIvar.
	self setProperty: #padding
		toValue: ((numberOrPoint class = Point) 
			ifTrue: [numberOrPoint] 
			ifFalse: [numberOrPoint @ numberOrPoint]).
	self morphExtent: (self minimumExtent max: self morphExtent).
	self redrawNeeded! !



More information about the Cuis-dev mailing list