non-blocking single character I/O

Tim Olson tim at jumpnet.com
Mon Feb 15 14:06:47 UTC 1999


>Is there someplace I can look up topics like how to get keystrokes
>as they arrive, or how to continue computing while waiting for one?

Take a look at Sensor>>keyboardPressed, Sensor>>keyboardPeek, and 
Sensor>>keyboard.

e.g.:

     key := Sensor keyboard.  "blocking I/O, wait for keystroke"

     key := Sensor keyboardPeek. "non-blocking I/O, get current keystroke 
or nil"

     [Sensor keyboardPressed] whileFalse:
          [compute while waiting for keystroke].

     


     -- tim





More information about the Squeak-dev mailing list