[plt-scheme] Keystrokes

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Nov 25 23:11:29 EST 2007

That's the generic way to catch key events. If you only want to catch
them in a canvas% object, you could override its on-event.

Robby

On Nov 25, 2007 9:50 PM, Richard Cleis <rcleis at mac.com> wrote:
> The following works, but overriding on-subwindow-char seems a little
> severe.  Is there another way to get the key-events?
>
> (require (lib "mred.ss" "mred")
>           (lib "class.ss" "mzlib"))
>
> (define  the-frame
>    (new (class* frame% ()
>           (define/override
>             (on-subwindow-char the-win key-event)
>             (display (send key-event get-key-code))
>             (newline))
>           (super-instantiate ()))
>         (label ":-)")
>         (width 100)
>         (height 100)))
>
> (send the-frame show #t)
>
> rac
>
> On Nov 22, 2007, at 7:22 PM, Robby Findler wrote:
>
>
> > In DrScheme's REPL, you must type return before any of the characters
> > are submitted to the input port.
> >
> > But you can probably with only a few lines make a window popup, wait
> > for a character to be typed there, and then go away.
> >
> > Robby
> >
> > On Nov 22, 2007 8:21 PM, Richard Cleis <rcleis at mac.com> wrote:
> >> Is it possible to (read-the-next-keystroke) without requiring the
> >> typing of <return>?
> >>
> >> rac
> >>
> >>
> >> _________________________________________________
> >>   For list-related administrative tasks:
> >>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >>
>
>


Posted on the users mailing list.