AW: Different text shapes

Ned Konz ned at bike-nomad.com
Thu Aug 19 13:20:16 UTC 2004


On Thursday 19 August 2004 3:00 am, Daria Spescha wrote:

> But if I just put your method in a subclass of EllipseMorph, there is an
> error message undefined message "is". (Line 4 of your code)

That's obviously garbage. Sorry about that.

> If I remove 
> this line, then nothing happens, the text just flows over the ellipse.
> Do I have to do something more (like call shrink wrap or something)?

My earlier statement about telling the TextMorph to "fill owners shape" is the 
important part that you missed.

I think shrinkWrap would just get in the way.

Attached is a whole class that does what I am describing.

Enjoy,
-- 
Ned Konz
http://bike-nomad.com

-------------- next part --------------
'From Squeak3.7gamma of ''17 July 2004'' [latest update: #5976] on 19 August 2004 at 6:17:46 am'!
EllipseMorph subclass: #TextFilledEllipseMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Test-NK'!

!TextFilledEllipseMorph methodsFor: 'initialization' stamp: 'nk 8/19/2004 06:17'!
initialize
	| tm |
	super initialize.
	tm := TextMorph new.
	tm string: 'This is a test of the text wrapping' fontName: 'Accuny' size: 15.
	tm fillingOnOff.
	self addMorph: tm.! !


!TextFilledEllipseMorph methodsFor: 'stepping and presenter' stamp: 'nk 8/19/2004 06:14'!
step
	| tm para sel |
	tm := submorphs at: 1 ifAbsent: [ ^self ].
	para := tm paragraph.
	para text size > para lines last last ifTrue: [
		"ran out of room to display the text; make the container bigger"
		sel := tm editor selectionInterval.
		self extent: (self extent + (4 at 4)).
		self fullBounds.
		tm selectFrom: sel start to: sel end. ]! !


!TextFilledEllipseMorph methodsFor: 'testing' stamp: 'nk 8/19/2004 06:17'!
stepTime
	^10! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

TextFilledEllipseMorph class
	instanceVariableNames: ''!


More information about the Squeak-dev mailing list