| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>tkerror (GCL TK Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="tkerror (GCL TK Manual)"> |
| 9 |
<meta name="keywords" content="tkerror (GCL TK Manual)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 15 |
<link href="Control.html" rel="up" title="Control"> |
| 16 |
<link href="tkvars.html" rel="next" title="tkvars"> |
| 17 |
<link href="tk.html" rel="prev" title="tk"> |
| 18 |
<style type="text/css"> |
| 19 |
<!-- |
| 20 |
a.summary-letter {text-decoration: none} |
| 21 |
blockquote.indentedblock {margin-right: 0em} |
| 22 |
div.display {margin-left: 3.2em} |
| 23 |
div.example {margin-left: 3.2em} |
| 24 |
div.lisp {margin-left: 3.2em} |
| 25 |
kbd {font-style: oblique} |
| 26 |
pre.display {font-family: inherit} |
| 27 |
pre.format {font-family: inherit} |
| 28 |
pre.menu-comment {font-family: serif} |
| 29 |
pre.menu-preformatted {font-family: serif} |
| 30 |
span.nolinebreak {white-space: nowrap} |
| 31 |
span.roman {font-family: initial; font-weight: normal} |
| 32 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 33 |
ul.no-bullet {list-style: none} |
| 34 |
--> |
| 35 |
</style> |
| 36 |
|
| 37 |
|
| 38 |
</head> |
| 39 |
|
| 40 |
<body lang="en"> |
| 41 |
<span id="tkerror"></span><div class="header"> |
| 42 |
<p> |
| 43 |
Next: <a href="tkvars.html" accesskey="n" rel="next">tkvars</a>, Previous: <a href="tk.html" accesskey="p" rel="prev">tk</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 44 |
</div> |
| 45 |
<hr> |
| 46 |
<span id="tkerror-1"></span><h3 class="section">3.20 tkerror</h3> |
| 47 |
|
| 48 |
<p>tkerror \- Command invoked to process background errors |
| 49 |
</p><span id="Synopsis-33"></span><h4 class="unnumberedsubsec">Synopsis</h4> |
| 50 |
<p><b>tkerror </b><i>message</i> |
| 51 |
</p> |
| 52 |
<span id="Description-31"></span><h4 class="unnumberedsubsec">Description</h4> |
| 53 |
|
| 54 |
<p>The <b>tkerror</b> command doesn’t exist as built-in part of Tk. Instead, |
| 55 |
individual applications or users can define a <b>tkerror</b> |
| 56 |
command (e.g. as a Tcl procedure) if they wish to handle background |
| 57 |
errors. |
| 58 |
</p> |
| 59 |
<p>A background error is one that occurs in a command that didn’t |
| 60 |
originate with the application. For example, if an error occurs |
| 61 |
while executing a command specified with a <b>bind</b><span class="roman"> of </span><b>after</b> |
| 62 |
command, then it is a background error. For a non-background error, |
| 63 |
the error can simply be returned up through nested Tcl command |
| 64 |
evaluations until it reaches the top-level code in the application; |
| 65 |
then the application can report the error in whatever way it |
| 66 |
wishes. When a background error occurs, the unwinding ends in |
| 67 |
the Tk library and there is no obvious way for Tk to report |
| 68 |
the error. |
| 69 |
</p> |
| 70 |
<p>When Tk detects a background error, it invokes the <b>tkerror</b> |
| 71 |
command, passing it the error message as its only argument. |
| 72 |
Tk assumes that the application has implemented the <b>tkerror</b> |
| 73 |
command, and that the command will report the error in a way that |
| 74 |
makes sense for the application. Tk will ignore any result returned |
| 75 |
by the <b>tkerror</b> command. |
| 76 |
</p> |
| 77 |
<p>If another Tcl error occurs within the <b>tkerror</b> command |
| 78 |
then Tk reports the error itself by writing a message |
| 79 |
to stderr. |
| 80 |
</p> |
| 81 |
<p>The Tk script library includes a default <b>tkerror</b> procedure |
| 82 |
that posts a dialog box containing the error message and offers |
| 83 |
the user a chance to see a stack trace that shows where the |
| 84 |
error occurred. |
| 85 |
</p> |
| 86 |
<span id="Keywords-34"></span><h4 class="unnumberedsubsec">Keywords</h4> |
| 87 |
<p>background error, reporting |
| 88 |
</p><hr> |
| 89 |
<div class="header"> |
| 90 |
<p> |
| 91 |
Next: <a href="tkvars.html" accesskey="n" rel="next">tkvars</a>, Previous: <a href="tk.html" accesskey="p" rel="prev">tk</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 92 |
</div> |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
</body> |
| 97 |
</html> |