Luc <
[email protected]d> wrote:
One of the rare things I dislike about Tcl/Tk is the error messages.
They pop up and I hate them.
If you wish to have the feedback, the information has to go somewhere.
Do note that you are going on about the "default" error popups, which
if they were not present would likely leave you with the basic C
equivalent of:
segmentation fault: process aborted
And absolutely no information on where.
Well, I've changed them a little. Larger, much better font, better key bindings and automatic focus so it's easier to copy the error message,
which I like to do so I can dismiss the error and paste the message
elsewhere for reference.
If you catch your own errors you can have any form of error message you
want to code. But you have to catch the errors (via either [catch] or
[try]) and then handle the error conditions yourself. Such is more
work, but you can have very finely tuned, highly relevant, error
feedback that way. But complaining about the provided default, which
if not provided would give you a "process aborted" message instead, is
a bit disingenuous. The default message, if you don't bother to catch
your errors and provide your own message, necessarially needs to be
reasonably generic and generally useful (and, compare Tcl's messages
with what Python or [shudder] Java provides on an error one day, and
you'll praise Tcl's nice, clean, useful, messages instead).
OK.
But this really annoys me:
can't read "dir": no such variable
can't read "dir": no such variable
while executing
"set dir"
(procedure "p.RunTime.Navigate" line 141)
invoked from within
"p.RunTime.Navigate "Up""
(command bound to event)
I hate it because line 141 is pointed out, but 141 is counted within
the proc! It's very hard to find.
Not a all. I jump my editor to the first line of the proc mentioned,
then I command the editor to do "down arrow" 141 times, and I arrive at
the very line that Tcl has referenced. Nothing could be simpler to
find.
Do note that the above does require one's editor to have the ability to "repeat" an edit operation some number of times. I use joe (Joe's Own
Editor,
https://en.wikipedia.org/wiki/Joe's_Own_Editor) in the jstar configuration.
That is another reason for me to make copying more convenient, so I
can copy the bad line and pray that I can find it exactly.
I should note here that on a modern windowing system with
multi-tasking, that you can keep the tk error message dialog up while simultaneously switching to the other window where you editor is
running, so that you can move about in your editor while simultaneously
viewing the Tk error popup. I do this all the time when I'm writing
Tcl/Tk code. The dialog pops up for some syntax error or type error,
and unless it happens to be for the last 5-10 new lines I just wrote, I
simply leave it open, switch to my editor window, and go about finding
the issue while the Tk message box is visible.
[dict get [info frame 0] line] can give me an exact, absolute line
number in relation to the entire file so why can't Tk error messages?
Possibly no one thought to do so, or the default error handling was
setup long ago (possibly before the 'line' key of info frame 0 existed)
and no one's been bothered enough by it to bother with tweaking it?
What file do I hack to achieve that?
Unfortunately I have no idea. I've never been bothered by the message
(and compared to Python or Java Tcl's messages are a dream of
usefulness) and so have never sought out what to change. And for
anything I write for consumption by others, I catch errors and provide
custom, domain specific, feedback, I don't expect others to want to see
the default popup.
Where is it?
The default error popup window is provided by the default bgerror
handler proc provided by Tcl. On my Slackware system the default
bgerror proc is defined in /usr/lib64/tk8.6/bgerror.tcl.
If you want to make changes, start by copying that file into your code,
then make your changes locally, the source your local changed copy
sometime during your startup (which will then overwrite the default
with your new and improved one) and you'll have a different dialog (or
even no dialog at all if you so desire).
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)