Tk Source Code

Check-in [f89fc3bb]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Unify error messages for wrong values of 'tk_messageBox -default' among platforms: Windows and X11 now return the same error
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-66db98f30d
Files: files | file ages | folders
SHA3-256: f89fc3bb5c0a7f2199500a86fe904c5d3cbac57b3d902aeb4e0b730f2e10c1cf
User & Date: fvogel 2018-05-01 12:37:46
Context
2018-05-01
12:48
Unify further error messages for tk_messageBox options check-in: ceca7257 user: fvogel tags: bug-66db98f30d
12:37
Unify error messages for wrong values of 'tk_messageBox -default' among platforms: Windows and X11 now return the same error check-in: f89fc3bb user: fvogel tags: bug-66db98f30d
12:20
Make msgbox.test pass on all platforms (checked on Win Vista, Linux Debian 8 and macOS 10.12.6) check-in: c2a16489 user: fvogel tags: bug-66db98f30d
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/msgbox.tcl.

230
231
232
233
234
235
236
237

238
239
240
241
242
243
244
	if {[lindex $btn 0] eq $data(-default)} {
	    set valid 1
	    break
	}
    }
    if {!$valid} {
	return -code error -errorcode {TK MSGBOX DEFAULT} \
	    "invalid default button \"$data(-default)\""

    }

    # 2. Set the dialog to be a child window of $parent
    #
    #
    if {$data(-parent) ne "."} {
	set w $data(-parent).__tk__messagebox






|
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
	if {[lindex $btn 0] eq $data(-default)} {
	    set valid 1
	    break
	}
    }
    if {!$valid} {
	return -code error -errorcode {TK MSGBOX DEFAULT} \
	    "bad -default value \"$data(-default)\": must be\
	    abort, retry, ignore, ok, cancel, no, or yes"
    }

    # 2. Set the dialog to be a child window of $parent
    #
    #
    if {$data(-parent) ne "."} {
	set w $data(-parent).__tk__messagebox

Changes to tests/msgbox.test.

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
test msgbox-1.11.1 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -type foo
} -returnCodes error -result {bad -type value "foo": must be abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel}
test msgbox-1.11.2 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -type foo
} -returnCodes error -result {bad value "foo": must be abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel}

test msgbox-1.12 {tk_messageBox command} -constraints x11 -body {
    tk_messageBox -default 1.1
} -returnCodes error -result {invalid default button "1.1"}
test msgbox-1.13 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -default 1.1
} -returnCodes error -result {bad value "1.1": must be abort, retry, ignore, ok, cancel, yes, or no}
test msgbox-1.13a {tk_messageBox command} -constraints win -body {
    tk_messageBox -default 1.1
} -returnCodes error -result {bad -default value "1.1": must be abort, retry, ignore, ok, cancel, no, or yes}

test msgbox-1.14 {tk_messageBox command} -constraints x11 -body {
    tk_messageBox -default foo
} -returnCodes error -result {invalid default button "foo"}

test msgbox-1.15 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -default foo
} -returnCodes error -result {bad value "foo": must be abort, retry, ignore, ok, cancel, yes, or no}
test msgbox-1.15a {tk_messageBox command} -constraints win -body {
    tk_messageBox -default foo
} -returnCodes error -result {bad -default value "foo": must be abort, retry, ignore, ok, cancel, no, or yes}

test msgbox-1.16 {tk_messageBox command} -constraints x11 -body {
    tk_messageBox -type yesno -default 3
} -returnCodes error -result {invalid default button "3"}
test msgbox-1.17 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -type yesno -default 3
} -returnCodes error -result {bad value "3": must be abort, retry, ignore, ok, cancel, yes, or no}
test msgbox-1.17a {tk_messageBox command} -constraints win -body {
    tk_messageBox -type yesno -default 3
} -returnCodes error -result {bad -default value "3": must be abort, retry, ignore, ok, cancel, no, or yes}

test msgbox-1.18 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -icon foo
} -returnCodes error -result {bad -icon value "foo": must be error, info, question, or warning}
test msgbox-1.18a {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -icon foo
} -returnCodes error -result {bad value "foo": must be error, info, question, or warning}






<
<
<
|

|
|

|

|

<
>



<
<
<

|

|



<
<
<







53
54
55
56
57
58
59



60
61
62
63
64
65
66
67
68

69
70
71
72



73
74
75
76
77
78
79



80
81
82
83
84
85
86
test msgbox-1.11.1 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -type foo
} -returnCodes error -result {bad -type value "foo": must be abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel}
test msgbox-1.11.2 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -type foo
} -returnCodes error -result {bad value "foo": must be abortretryignore, ok, okcancel, retrycancel, yesno, or yesnocancel}




test msgbox-1.13 {tk_messageBox command} -constraints nonAqua -body {
    tk_messageBox -default 1.1
} -returnCodes error -result {bad -default value "1.1": must be abort, retry, ignore, ok, cancel, no, or yes}
test msgbox-1.13a {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -default 1.1
} -returnCodes error -result {bad value "1.1": must be abort, retry, ignore, ok, cancel, yes, or no}

test msgbox-1.14 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -default foo

} -returnCodes error -result {bad -default value "foo": must be abort, retry, ignore, ok, cancel, no, or yes}
test msgbox-1.15 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -default foo
} -returnCodes error -result {bad value "foo": must be abort, retry, ignore, ok, cancel, yes, or no}




test msgbox-1.16 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -type yesno -default 3
} -returnCodes error -result {bad -default value "3": must be abort, retry, ignore, ok, cancel, no, or yes}
test msgbox-1.17 {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -type yesno -default 3
} -returnCodes error -result {bad value "3": must be abort, retry, ignore, ok, cancel, yes, or no}




test msgbox-1.18 {tk_messageBox command} -constraints notAqua -body {
    tk_messageBox -icon foo
} -returnCodes error -result {bad -icon value "foo": must be error, info, question, or warning}
test msgbox-1.18a {tk_messageBox command} -constraints aqua -body {
    tk_messageBox -icon foo
} -returnCodes error -result {bad value "foo": must be error, info, question, or warning}