From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-05-29T17:19:32+09:00 Subject: Re: drawing on a scrolled (Tk)canvas In article , Phil Tomson wrote: >It seems that after a TkCanvas has been scrolled, there is a mismatch >between coordinate values reported after a left-click on the canvas and >where items have actually been drawn on the canvas. > >I'm trying to scroll a canvas and have the ability to draw a 'cursor' on >the canvas at the location of a left mouse click, but what I find is that >there is a mismatch between where the cursor is drawn and where the mouse >is clicked if the canvas has been scrolled. Can someone explain what >happens to the coordinate system of a canvas after a scroll? > I found the answer: use the canvasx and canvasy functions like: @canvas.bind('1',proc{|e| @manager.update_cursors(@canvas.canvasx(e.x)) }) seems to do the trick. Phil