thanks Re: how to??? TextMorph and Alignment

Nicholas Bennett nicholasjbennett at hotmail.com
Fri Feb 10 07:32:23 UTC 2006


thanks - that sounds like exactly what I needed to know!

>From: Steven Elkins <sgelkins at gmail.com>
>Reply-To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>Subject: Re: how to??? TextMorph and Alignment
>Date: Thu, 9 Feb 2006 22:05:11 -0500
>
>On 2/9/06, Nicholas Bennett <nicholasjbennett at hotmail.com> wrote:
> >
> > I am trying to construct a small GUI interface to add text items to a 
>list
> > of text items.
> >
> > I found that TextMorph seemed to have the capabilities I wanted in that 
>it
> > could accept focus and give an insertion cursor and you can get and set 
>the
> > characters.
> >
> > If I do 'TextMorph borderedPrototype openInHand' I get that 'nice' 
>behaviour
> > in a free floating morph.
> >
> > If I make an AlignmentMorph (to contain it and the list) and drop the 
>above
> > TexstMorph it continues to work fine (you can type in it).
> >
> > If I programatically construct the AlignmentMorph and insert a new 
>TextMorph
> > and then open the containing Alignment, like:
> >
> > |a|
> > a := AlignmentMorph newRow; extent: 200 at 200.
> > a addMorph: TextMorph borderedPrototype.
> > a openInHand
>
>Removing the ; after newRow, I get what you do.
>
> > then the TextMorph will not 'take' an insertion cursor and seems
> > 'dead'/'deaf' to the mouse.
>
>So I hacked it a little...
>
>|a|
>a := AlignmentMorph newRow extent: 200 at 200.
>a addMorph: (TextMorph borderedPrototype isPartsDonor: false; yourself).
>a openInHand
>
>...thus undoing one of the chains of events (markAsPartsDonor) started
>by borderedPrototype.  Morph>>openInHand undoes it too, which explains
>why you can type into it.  Here's TextMorph's implementation of
>handlesMouseDown: ...
>
>handlesMouseDown: evt
>	self isPartsDonor ifTrue: [^ false].
>	^ self innerBounds containsPoint: evt cursorPoint
>
>...a little more light on the subject.
>
>Hope this helps,
>Steve
>
>--
>How wonderful it is that nobody need wait a single moment
>before starting to improve the world.       -- Anne Frank
>Paradise is exactly where you are
>right now...only much, much better.    -- Laurie Anderson
>





More information about the Squeak-dev mailing list