Maybe It would be better if you insert a label inside your canvas and you only change the text on It. It would be really faster than destrolling and creating the canvas everytime. You can also write text on the canvas, and change It when you need.<br>
<br>Felip.<br><br><div class="gmail_quote">2008/12/29 christopher melen <span dir="ltr"><<a href="mailto:chris_melen@yahoo.com">chris_melen@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I'm trying to display the coordinates of the mouse pointer. My app consists of a canvas and a 'statusbar', both of which are contained in a toplevel. The statusbar (which is just a frame containing another canvas) contains text displaying the current position of the mouse pointer, and this is updated as the pointer moves. What I'm doing is deleting and then recreating the text with the new coordinates, but this results in an unpleasant 'flashing' effect (not so bad on WinXP but terrible on OS X). Is there a more efficient way of doing this? I know there are Tk-based apps which achieve this effect (such as Wavesurfer), so it must be do-able. This is the relevant event handler code -<br>

<br>
(bind *canvas* "<Motion>"<br>
      (lambda (evt)<br>
            (let* ((x (event-x evt))<br>
                   (y (event-y evt)))<br>
                  (setf *x-coord* x *y-coord* y)<br>
                  (itemdelete *statusbar* *coord-display*)<br>
                  (make-coord-display))))<br>
<br>
*canvas* is the main canvas, and *statusbar* the statusbar. *x-coord* and *y-coord* are bound to the current pointer coordinates, which are used by the statusbar's text item (bound to *coord-display*). The function MAKE-COORD-DISPLAY then recreates the text on the statusbar immediately after it has been deleted (hence the flashing).<br>

<br>
Many thanks in advance for any suggestions.<br>
<br>
Chris<br>
<br>
P.S: Also a strange thing happens if I use the above code for a canvas owned by a paned-window - the sash disappears. Odd...<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
ltk-user site list<br>
<a href="mailto:ltk-user@common-lisp.net">ltk-user@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/ltk-user" target="_blank">http://common-lisp.net/mailman/listinfo/ltk-user</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Felip Alàez Nadal<br>