Delivered-To: garrigue at math.nagoya-u.ac.jp Delivered-To: lablgtk at yquem.inria.fr Message-ID: <4B464D80.3080901 at starynkevitch.net> Date: Thu, 07 Jan 2010 22:09:20 +0100 From: Basile STARYNKEVITCH MIME-Version: 1.0 To: lablgtk at yquem.inria.fr Subject: Re: [Lablgtk] drawing area & events References: <4B464B1B.4070701 at starynkevitch.net> In-Reply-To: <4B464B1B.4070701 at starynkevitch.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Basile STARYNKEVITCH wrote: > > let buttonfun bev = > let butnum = GdkEvent.Button.button bev > and x = (int_of_float (GdkEvent.Button.x bev)) > and y = (int_of_float (GdkEvent.Button.x bev)) > in > Printf.eprintf "buttonfun butnum=%d x=%d y=%d\n%!" butnum x y; > pointslist := (x,y)::!pointslist; > () > ;; Sorry for the stupid mistake - a typo in the y line, which should of course be and y = (int_of_float (GdkEvent.Button.y bev)) So the function should be let buttonfun bev = let butnum = GdkEvent.Button.button bev and x = (int_of_float (GdkEvent.Button.x bev)) and y = (int_of_float (GdkEvent.Button.y bev)) in Printf.eprintf "buttonfun butnum=%d x=%d y=%d\n%!" butnum x y; pointslist := (x,y)::!pointslist; () ;; > > For some reason, the mouse click coordinates are not correct in the > drawing area. I should make some conversion (how to do that)? My fault! However, I am still not getting any key event. Any idea? ignore (drawar#event#add [ `BUTTON_PRESS; `KEY_PRESS; `FOCUS]); don't seems to work. Regards -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk