3 # This file contains a default version of the tkError procedure. It
4 # posts a dialog box with the error message and gives the user a chance
5 # to see a more detailed stack trace.
7 # Copyright (c) 1992-1994 The Regents of the University of California.
8 # Copyright (c) 1994-1995 Sun Microsystems, Inc.
9 # Copyright (c) 1999 Christian Werner
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 if {[winfo depth .] > 1} {
15 option add *ckerrorDialog*background red
16 option add *ErrorTrace*background red
19 # Fake the auto_mkindex procedure for Tcl 7.4 \
22 # Fake the auto_mkindex procedure for Tcl 7.5 and above \
26 # This is the default version of tkerror. It posts a dialog box containing
27 # the error message and gives the user a chance to ask to see a stack
31 # err - The error message.
33 if {$tcl_version > 7.4} {
34 set ckPriv(bgErrProc) bgerror
36 set ckPriv(bgErrProc) tkerror
38 proc $ckPriv(bgErrProc) err {
41 set button [ck_dialog .ckerrorDialog "Error in Tcl Script" \
42 "Error: $err" Okay Skip Trace]
45 } elseif {$button == 1} {
50 toplevel $w -class ErrorTrace \
51 -border { ulcorner hline urcorner vline lrcorner hline llcorner vline }
52 place $w -relx 0.5 -rely 0.5 -anchor center
53 label $w.title -text "Stack Trace for Error"
54 place $w.title -y 0 -relx 0.5 -anchor center -bordermode ignore
55 button $w.ok -text OK -command "destroy $w"
56 scrollbar $w.scroll -command "$w.text yview" -takefocus 0
57 text $w.text -yscrollcommand "$w.scroll set"
58 frame $w.sep -border hline
59 pack $w.ok -side bottom -ipadx 1
60 pack $w.sep -side bottom -fill x
61 pack $w.scroll -side right -fill y
62 pack $w.text -side left -expand 1 -fill both
63 $w.text insert 0.0 $info
64 $w.text mark set insert 0.0
65 bind $w.text <Tab> {focus [ck_focusNext %W] ; break}