[squeak-dev] TextMorph minimal width

St├ęphane Rollandin lecteur at zogotounga.net
Mon Aug 8 20:41:28 UTC 2022


Hello,

In 6.0

	(TextMorph new contents: 'B';
		backgroundColor: Color green)
			openInHand

yields a Morph that is wider than needed by an extra character

changing #minCompositionWidth in TextMorph by removing the * 2 fixes 
that problem, but introduces another one (bad layout of modal window 
titles) that can itself be fixed by reintroducing the same * 2 in 
#minWidth as follow:

minWidth

	| result |
	result := self minCompositionWidth * 2 + (self borderWidth*2).
	margins ifNil: [^ result].
	
	^ margins isRectangle
		ifTrue: [result + margins left + margins right]
		ifFalse: [margins isPoint
			ifTrue: [result + margins x + margins x]
			ifFalse: [result + (2*margins)]]

Is that correct?


Stef


More information about the Squeak-dev mailing list