TextMorph behavior

Chris Muller afunkyobject at yahoo.com
Wed Mar 22 22:46:02 UTC 2006


Hi Marcus, I have done this in Maui.  I had to subclass TextMorph (MauiStringEditor) and override #handleKeystroke: to dynamically adjust the extent.  So, when you start typing in Maui, the text morph is small, just big enough to hold about one character.  Then, as you continue typing, it will take the first-line out to a fair one-line width (1/7th the width of the World) before expanding its height to two-lines.
 
 As you keep typing, it maintains that width until it starts to get too tall.  "Too tall" is where its width:height is < 4:3; i.e., it maintains a 4:3 width to height ratio as you keep typing.
 
 I put quite a bit of thought and work into this, if you would like to check it out, if at least for an example of dynamically growing your TextMorph, load "Maui" from SqueakSource into a 3.8 image and then look at the MauiStringEditor class (a subclass of TextMorph).
 
 You can type MauiStringEditor new openInHand to play with it.
 
 Cheers,
   Chris
 
 

----- Original Message ----
From: Marcus Pedersén <marcus.pedersen at comhem.se>
To: squeak-dev at lists.squeakfoundation.org
Sent: Wednesday, March 22, 2006 2:15:22 PM
Subject: TextMorph behavior

Hi!
I have been trying class TextMorph out for making an editable
textfield for my GUI.
One thing I can't figure out is how to make the text "grow"
horisontaly when you write instead of verticaly.
I am after the behavior similar to the spotlight search text field in
mac. If you write loads of text the oldest text "dissapear" (visualy)
on the left hand.
I have tried autoFit: false and wrapFlag: false without any desired
results.
Doesn't TextMorph contain this functionality from start?
Do I need to subclass and write the function from scratch?
Many thanks in advance!
Marcus








More information about the Squeak-dev mailing list