Version 8 of Favorite debugging techniques applicable to Tcl

Updated 2004-12-23 18:01:19

Frank Pilhofer's Reload, Refresh, ..., David Welton's endless reloads, Jeffrey Hobbs' use of "fresh" tkcon tabs [L1 ], as well as Keith Vetter's console resets [L2 ] ...

A minimal debugger ...


RS routinely puts into Tk-provided scripts under development these two lines:

 bind . <Escape> {exec wish $argv0 &; exit}
 bind . <F1> {console show} ;# Windows only

With an interactive console, the following shortcut is often helpful:

 interp alias {} ? {} set errorInfo

Another little helper to display canvas x/y coordinates in the title bar:

 bind .c <Motion> {wm title . %x/%y}

LES: Hmm... I have this:

 frame $::w.wframe
 text $::w.wframe.textw
 scrollbar $::w.wframe.sbar

Then I bind it:

 bind $::w.wframe.textw <Motion> {wm title $::w "Position:  %x/%y" }

It works, but only so far as I move the mouse around the text widget. It won't work when I move it over the scroll or title bar. Certainly because I made a binding for the text widget only. Instead, I should bind the mouse movement to the frame, because it contains everything, right?

 bind $::w.wframe <Motion> {wm title $::w "Position:  %x/%y" }

Wrong. Now it only works when I move the mouse over the scroll bar. But isn't the text widget contained in the frame too? What is wrong with my assumption?

And I guess it is impossible to detect mouse movement over the title bar?


Category Debugging