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

Re: help with a mouse events in scheme



On Thu, May 31, 2001 at 04:47:10PM +0200, Claudio Gamberini wrote:
> hello, my porblem is to intercept the mouse click into a canvas

You can do something like this:

(define my-canvas%
  (class canvas% (frame) 
	 (override
	  (on-event
	   (lambda (event)
	     (let ((type (send event get-event-type)))
	       (cond
		((eq? type 'left-down)
		 ...)
		((eq? type 'left-up)
		 ...))))))
	 (sequence (super-init frame '(vscroll hscroll)))))

-- 
%!PS
297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100
180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180
0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont
240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage