summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericm <ericm>2000-06-19 18:28:56 (GMT)
committerericm <ericm>2000-06-19 18:28:56 (GMT)
commit85d8c4014f68a832ea11c9a60229f515dd01322e (patch)
tree6e3ab1fb7a669c2cc30628537cc3c0d225154ad1
parentd05dd51ce0054b3336326939525520bd45db5c00 (diff)
downloadtk-85d8c4014f68a832ea11c9a60229f515dd01322e.zip
tk-85d8c4014f68a832ea11c9a60229f515dd01322e.tar.gz
tk-85d8c4014f68a832ea11c9a60229f515dd01322e.tar.bz2
* library/bgerror.tcl: Added auto-truncation for long error
messages (more than 30 characters wide, or more than 4 lines long), so that the dialog remains a manageable size. [RFE: 5782]
-rw-r--r--ChangeLog10
-rw-r--r--library/bgerror.tcl28
2 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f6e959..23de88a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-06-19 Eric Melski <ericm@scriptics.com>
+
+ * library/bgerror.tcl: Added auto-truncation for long error
+ messages (more than 30 characters wide, or more than 4 lines
+ long), so that the dialog remains a manageable size. [RFE: 5782]
+
+2000-06-15 Eric Melski <ericm@scriptics.com>
+
+ * win/tkWinDialog.c: Patched to support tk_getOpenFile -multiple.
+
2000-06-13 Eric Melski <ericm@scriptics.com>
* win/aclocal.m4:
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index aaa671e..41c1ef3 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -9,8 +9,8 @@
# Copyright (c) 1998-2000 by Ajuba Solutions.
# All rights reserved.
#
-# RCS: @(#) $Id: bgerror.tcl,v 1.10 2000/06/05 23:03:30 ericm Exp $
-# $Id: bgerror.tcl,v 1.10 2000/06/05 23:03:30 ericm Exp $
+# RCS: @(#) $Id: bgerror.tcl,v 1.11 2000/06/19 18:28:56 ericm Exp $
+# $Id: bgerror.tcl,v 1.11 2000/06/19 18:28:56 ericm Exp $
option add *ErrorDialog.function.text "Save To Log" widgetDefault
option add *ErrorDialog.function.command "::tk::dialog::error::saveToLog"
@@ -103,9 +103,29 @@ proc bgerror err {
set textHilight 1
}
+
+ # Truncate the message if it is too wide (longer than 30 characacters) or
+ # too tall (more than 4 newlines). Truncation occurs at the first point at
+ # which one of those conditions is met.
+ set displayedErr ""
+ set lines 0
+ foreach line [split $err "\n"] {
+ if { [string length $line] > 30 } {
+ append displayedErr "[string range $line 0 29]..."
+ break
+ }
+ if { $lines > 4 } {
+ append displayedErr "..."
+ break
+ } else {
+ append displayedErr "${line}\n"
+ }
+ incr lines
+ }
+
set w .bgerrorDialog
set title "Application Error"
- set text "Error: $err"
+ set text "Error: $displayedErr"
set buttons [list ok $ok dismiss "Skip Messages" function "Details >>"]
# 1. Create the top-level window and divide it into top
@@ -148,7 +168,7 @@ proc bgerror err {
scrollbar $W.scroll -relief sunken -command "$W.text yview"
pack $W.scroll -side right -fill y
pack $W.text -side left -expand yes -fill both
- $W.text insert 0.0 $info
+ $W.text insert 0.0 "$err\n$info"
$W.text mark set insert 0.0
$W.text configure -state disabled