Strange behavior using Text and TextMorph

Boris Gaertner Boris.Gaertner at gmx.net
Thu Feb 26 21:19:51 UTC 2004


From: "Alexandre Bergel" <bergel at iam.unibe.ch>


> Screen capture by Ken
> http://www.kencausey.com/colortext.gif

Here we see this expression:
 ((Text fromString: 'This is aText') addAttribute: TextColor green)
       asMorph openInHand

The asMorph is defines in Object as:
  self asString asMorph.

That takes the string out of the text; the text attributes
are ignored.

To fix the situation, you should add:

asMorph

  ^TextMorph new contents: self

to the instance protocol of Text. This should help.

Greetings, Boris




More information about the Squeak-dev mailing list