[plt-scheme] mouse-event

From: The Computer Man (thecomputerman at wanadoo.fr)
Date: Fri Apr 11 01:41:03 EDT 2003

I would like to create a function which awaits that the utilisitator is
clicked with the left button of his mouse in the canvas, thereafter that
recovers co-ordinate X then the co-ordinate Y then that rounds these
co-ordinates there and finally if they well the left button of then in a
hurry one calls a function.
This is the function was writing but not running, i'm define a mouse event
(define mouse (make-object mouse-event% 'left-down))
(define (wait-click j)
  (let* ((posnx (send mouse get-x))
         (posny (send mouse get-y)))
    (define x (- (+ posnx (- 40 (modulo posnx 40))) 40))
    (define y (- (+ posny (- 40 (modulo posny 40))) 40))
    (cond ((send mouse button-down? 'left) draw(x y j)))))

How could I do that I tested with one-vent in canvas% but it does not do
anything? My goal and to wait until this event east took place is not that
it is already took place, as that this master key with my function: - (
thank you by advance for your answers

Posted on the users mailing list.