[racket] Can I capture the mouse events of canvas% without sub-classing?

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Fri Nov 29 16:18:59 EST 2013

Am I right in thinking that while you can add a callback to respond
the on-paint event of canvas% at construction time, i.e..

(new canvas% ...
    [paint-callback (lambda (c e) ...)])

to respond to other events -- mouse, keyboard, etc. -- it is necessary to
sub-class?

E.g.

(define my-canvas%
  (class canvas%
    (define/override (on-event ev)
      (when (send ev button-down? 'left)
        ; do something
    (super-new)))

Or are there alternatives?


Thanks

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131130/714042e5/attachment.html>

Posted on the users mailing list.