summaryrefslogtreecommitdiffstats
path: root/library/msgbox.tcl
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-08-27 19:48:23 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-08-27 19:48:23 (GMT)
commit55ad282f48e04748a7cf3d375ad3fc2abb47c0a1 (patch)
treec8cd1c66faa65fac8be9a9a85c0fc3ba7b8a564f /library/msgbox.tcl
parentbd27ced6025b5ce285080806ecd44c8b9bc1786a (diff)
parentef65c6ff80f269b8e94aa1ff98e76831b93c4550 (diff)
downloadtk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.zip
tk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.tar.gz
tk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.tar.bz2
Generate -errorcode values to go with errors. Generate messages and postscript
using Tcl_Obj API, not the string result API.
Diffstat (limited to 'library/msgbox.tcl')
-rw-r--r--library/msgbox.tcl20
1 files changed, 12 insertions, 8 deletions
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 60a2a19..10e91f1 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -111,7 +111,7 @@ static unsigned char w3_bits[] = {
0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};"
-
+
# ::tk::MessageBox --
#
# Pops up a messagebox with an application-supplied message with
@@ -153,8 +153,9 @@ proc ::tk::MessageBox {args} {
tclParseConfigSpec $w $specs "" $args
- if {[lsearch -exact {info warning error question} $data(-icon)] == -1} {
- error "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
+ if {$data(-icon) ni {info warning error question}} {
+ return -code error -errorcode [list TK LOOKUP ICON $data(-icon)] \
+ "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
}
set windowingsystem [tk windowingsystem]
if {$windowingsystem eq "aqua"} {
@@ -169,7 +170,8 @@ proc ::tk::MessageBox {args} {
}
if {![winfo exists $data(-parent)]} {
- error "bad window path name \"$data(-parent)\""
+ return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
+ "bad window path name \"$data(-parent)\""
}
switch -- $data(-type) {
@@ -204,9 +206,10 @@ proc ::tk::MessageBox {args} {
set cancel cancel
}
default {
- error "bad -type value \"$data(-type)\": must be\
- abortretryignore, ok, okcancel, retrycancel,\
- yesno, or yesnocancel"
+ return -code error -errorcode [list TK LOOKUP DLG_TYPE $data(-type)] \
+ "bad -type value \"$data(-type)\": must be\
+ abortretryignore, ok, okcancel, retrycancel,\
+ yesno, or yesnocancel"
}
}
@@ -230,7 +233,8 @@ proc ::tk::MessageBox {args} {
}
}
if {!$valid} {
- error "invalid default button \"$data(-default)\""
+ return -code error -errorcode {TK MSGBOX DEFAULT} \
+ "invalid default button \"$data(-default)\""
}
# 2. Set the dialog to be a child window of $parent