TextMorph behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

TextMorph behavior

Marcus Pedersén
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

Reply | Threaded
Open this post in threaded view
|

Re: TextMorph behavior

karl-8
Marcus Pedersén skrev:

> 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
I think you would have to subclass to be able to get the behavior you
describe. TextMorph is very confusing and hard to make behave the way
you want.
Karl

>
>
>
> --No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.2.6/287 - Release Date: 2006-03-21
>
>


Reply | Threaded
Open this post in threaded view
|

Re: TextMorph behavior

Chris Muller-2
In reply to this post by Marcus Pedersén
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 <[hidden email]>
To: [hidden email]
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






Reply | Threaded
Open this post in threaded view
|

Re: TextMorph behavior

Chris Muller-2
> 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.
 
... until it reaches its #maxExtent (half screen) at which point the scroll bar appears..  Kinda cool!  :)
 
 And it does have a bug or two, with cut and paste I think..




Reply | Threaded
Open this post in threaded view
|

Re: TextMorph behavior

Sean P. DeNigris
Administrator
In reply to this post by Chris Muller-2
Chris Muller-2 wrote
Hi Marcus, I have done this in Maui.  I had to subclass TextMorph (MauiStringEditor) and override #handleKeystroke: to dynamically adjust the extent.
Can we make TextMorph use the Maui growing behavior?  I find it much more intuitive and useful.  I often cringe at the current "keep the width constant and grow vertically" behavior.  I pulled the Class out into a GrowableTextMorph, but I think the behavior should just be folded into TextMorph.  If necessary, we could even set the default maxWidth to simulate how TextMorph currently works for backward-compatibility.

What do you all think?

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TextMorph behavior

Chris Muller-3
TextMorph is a very generic widget,so I can see the need to maintain
the existing functionality, however I think it would be a nice option
/ preference.  One thing I always wanted to improve on was the way it
automatically resizes; instead of just one-pixel at a time, to be able
to "zoom" more quickly to the optimal size.  However, my attempts to
do so invariably caused an oscillation between "too small" and "too
large".

 - Chris

On Sun, Jan 16, 2011 at 12:05 AM, Sean P. DeNigris
<[hidden email]> wrote:

>
>
> Chris Muller-2 wrote:
>>
>> Hi Marcus, I have done this in Maui.  I had to subclass TextMorph
>> (MauiStringEditor) and override #handleKeystroke: to dynamically adjust
>> the extent.
>>
>
> Can we make TextMorph use the Maui growing behavior?  I find it much more
> intuitive and useful.  I often cringe at the current "keep the width
> constant and grow vertically" behavior.  I pulled the Class out into a
> GrowableTextMorph, but I think the behavior should just be folded into
> TextMorph.  If necessary, we could even set the default maxWidth to simulate
> how TextMorph currently works for backward-compatibility.
>
> What do you all think?
>
> Sean
> --
> View this message in context: http://forum.world.st/TextMorph-behavior-tp48128p3219757.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>