[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with mouse events in scheme



There are two interfaces to graphics for MrEd -- a general purpose 
class-based interface and a simpler function-based interface. To read 
about the functional interface, see the viewport part of the misclib 
documentation in Help Desk.

For the class-based interface, try this:

(define clickable-canvas%
   (class canvas% args
     (override
       [on-event
        (lambda (evt)
          (when (send evt button-up?)
            (printf "click at (~a,~a)~n" (send evt get-x) (send evt get-y))))])
     (sequence
       (apply super-init args))))

(define f (make-object frame% "frame" #f 100 100))
(make-object clickable-canvas% f)
(send f show #t)

Hope that helps!

Robby

At 8:04 PM +0200 6/6/01, Claudio Gamberini wrote:
>hello, i'm a student of computer science in Italy, i'm going to 
>learn more abuot scheme and i have develop a graphical interface 
>with PLT MrEd: Graphical Toolbox Manual. The problem is that i don't 
>undestand who to manage mouse events. I read the manual but ... Can 
>you help me with an example of mouse management, in particular with 
>a function that at the mouse click do someone ....
>
>Thanks