TextMorph code - help!

Gary McGovern garywork at lineone.net
Fri Dec 21 19:34:32 UTC 2001


Thanks lads,
It was the extent I needed. Though the argument could be smaller.

book := BookMorph new.
text := TextMorph new.
text string: 'Hello There !' fontName: 'ComicBold' size: 24.
text extent: 200 at 200.
text visible.
book currentPage addMorph: text.
book openInWorld.

Gary

----- Original Message -----
From: "Bob Arning" <arning at charm.net>
To: <garywork at lineone.net>; <squeak-dev at lists.squeakfoundation.org>
Sent: Friday, December 21, 2001 5:24 AM
Subject: Re: TextMorph code - help!


On Fri, 21 Dec 2001 03:13:08 -0000 "Gary McGovern" <garywork at lineone.net>
wrote:
>When I code a TextMorph to openInWorld with ComicBold 24, it is always
wrapped. What message is used so that it displays in a straight line. I
can't find that message.

Gary,

It depends on when and how you set the font. The example below works, but it
didn't until I added the line noted. Before that it was composing the line
(and thus the size of the TextMorph) based on the default font rather than
ComicBold.

TextMorph new
contents: 'this is something longer than normal';
fontName: #ComicBold size: 24;
releaseCachedState; "<----added"
openInWorld

this also works:

TextMorph new
contents: '?';
fontName: #ComicBold size: 24;
contents: 'this is something longer than normal';
openInWorld

Cheers,
Bob







More information about the Squeak-dev mailing list