[racket] puzzled by what (send key-event get-key-code) returns
Ahh, I thought they were bound together in some sort of a mysterious
structure. Thanks.
On Tue, Feb 25, 2014 at 4:53 PM, Jay McCarthy <jay.mccarthy at gmail.com>wrote:
> When you press a key, say A, and then release it, there are two
> key-events that are registered. The first has "get-key-code" as #\A.
> The second has "get-key-code" 'release and #\A is returned by
> get-release-key-code.
>
> Jay
>
> On Tue, Feb 25, 2014 at 5:49 PM, Tom Dean <tld at google.com> wrote:
> > If I create an instance of canvas% or editor-canvas% like
> >
> > (define THE-CANVAS (new (class editor-canvas%
> > (super-new)
> > ;; Key handler for key-stroke input:
> > (define/override (on-char key-event)
> > (let ([event (send key-event
> > get-key-code)])
> > (printf "EQ? ~s~n" (eq? event
> #\[)))))))
> >
> > and then hit the [ key it's as though the event is a pair consisting of
> a
> > char #\[ and the symbol 'release:
> >
> > EQ? #t
> > EQ? #f
> >
> > bur event isn't a pair?, list? or any other type as far as I can tell.
> And
> > it doesn't appear that get-key-code is returning multiple values, at
> least
> > in the sense of being something I can capture with let-values or
> set-values.
> > Any clues how I might capture just the key code and not the release
> symbol?
> >
> >
> > ____________________
> > Racket Users list:
> > http://lists.racket-lang.org/users
> >
>
>
>
> --
> Jay McCarthy <jay at cs.byu.edu>
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
>
> "The glory of God is Intelligence" - D&C 93
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140225/d0e642fe/attachment-0001.html>