monitoring keypresses

Ned Konz ned at bike-nomad.com
Sun Aug 26 15:48:50 UTC 2001


On Sunday 26 August 2001 07:51 am, Frantisek Fuka wrote:
> How can my object monitor all keypresse when working in Squeak?
> For example, I want my activity in Workspace and System Browser to have
> its full original functionality but at the same time I want my personal
> object to monitor all keypresses. The important thing is, I want to
> monitor ALL keyboard activity, no matter where my mouse pointer is
> currently located and what morphs are currently displayed.

You can hook into the event loop. Look at HandMorph::addEventListener:, which 
is the hook used by the EventRecorder.

> Second question: Is there a Class which waits for a single keypress and
> then returns it?

Doing what with the keypress? If you're going to swallow the key, you need to 
set keyboard focus, and handle the keyboard event. Then release the keyboard 
focus.

If you're not going to swallow the key (if you want the key to be passed on 
to whatever Morph has the keyboard focus), you can use the addEventListener: 
hook.

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




More information about the Squeak-dev mailing list