Hi,
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 -
(bind *canvas* "<Motion>"
(lambda (evt)
(let* ((x (event-x evt))
(y (event-y evt)))
(setf *x-coord* x *y-coord* y)
(itemdelete *statusbar* *coord-display*)
(make-coord-display))))
*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).
Many thanks in advance for any suggestions.
Chris
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...