[Q] TextMorph horizontal growth?

Chris Muller afunkyobject at yahoo.com
Fri Jan 9 05:43:24 UTC 2004


I need to have a one-line TextMorph that grows only horizontally to accomodate
whatever is typed.

I first tried setting autoFit: true and wrapFlag: false, however, it grows
vertically, not horizontally.

After poking around, I figured out I could force it to reformat to one-line
with #composeToBounds.

So I overrode handleKeystroke in my own subclass:

  super handleKeystroke: aKeyboardEvent.
  self composeToBounds

This almost works.  The only problem is the cursor-position after calling
#composeToBounds is no longer at the end of the text, so it keeps inserting at
the beginning and your phrase ends up BACKWARD!!   :-)

Perhaps I'm getting into unnecessary-hacking here..  Is there an easy way to do
this?

Thank you!
  Chris



More information about the Squeak-dev mailing list