Different text shapes
Ned Konz
ned at bike-nomad.com
Thu Aug 12 15:28:13 UTC 2004
On Thursday 12 August 2004 6:54 am, Daria Spescha wrote:
> I'm sorry, but I have again a problem: I need text fields with different
> shapes, for example ellipse text fields …
You can put a TextMorph into an Ellipse and then tell it to "fill owner's
shape" and if you want "avoid occlusions" and it will use the Ellipse's
shadow as its bounds when re-composing.
> NCTextRectangle behaves exactly as I want the ellipse text to behave,
> but I couldn't find out which part is important for that.
The TableLayout/shrinkWrap interaction only works with rectangular morphs.
What happens when you tell a TextMorph to fill the owner's shape is that it
stops composing when it runs out of room.
You could test for this in a step method somewhere. Here's one that I put in
an EllipseMorph subclass (assumes a TextMorph is its first submorph):
step
| tm para sel |
tm := submorphs at: 1 ifAbsent: [ ^self ].
tm is
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. ]
This seems to work OK if the stepTime is fast enough.
--
Ned Konz
http://bike-nomad.com
More information about the Squeak-dev
mailing list
|