How to force AcceptableCleanTextMorph to accept for each character typed?

Ned Konz ned at bike-nomad.com
Mon Apr 1 22:31:52 UTC 2002


On Monday 01 April 2002 02:19 pm, Ken G. Brown wrote:
> I would like to have one of my AcceptableCleanTextMorphs pass characters
> through to the #accept method as characters are typed, a character at a
> time. What would the best way to accomplish that?
> #hasUnacceptedEdits might do it I suspect but how? Where would I need to do
> the check?
>
> Perhaps AcceptableCleanTextMorph is not the right way to address the
> problem. Basically I need a small command window that immediately sends
> characters when typed.

You need to make sure that you get mouse focus (tell the Hand when the mouse 
enters you), then override handlesKeyboard: to return true, and override 
keyStroke:.

Look at (for instance) Tetris to see how to do this.

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




More information about the Squeak-dev mailing list