[Q] TextMorph, MouseMoveEvent and detecting a word

Ned Konz ned at bike-nomad.com
Sat Jan 19 19:07:49 UTC 2002


On Friday 18 January 2002 04:56 pm, Hannes Hirzel wrote:
> Hi
>
> I'd like to know over which word the mouse is in the text of a TextMorph.
> The message
> handleMouseMove: anEvent
> is sent to the TextMorph, where anEvent is a MouseMoveEvent. It has the
> instance variable 'position' which is a Point.
>
> So my question is how to find out a word in a TextMorph given a point in
> it. Could somebody help me please?

from the point of view of the PluggableTextMorph

something like
textMorph paragraph characterBlockAtPoint: aPoint

should get you started (I think, from a quick look over the code).

note that aPoint would be relative to the textMorph bounds.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list