1tk_messageBox(n) Tk Built-In Commands tk_messageBox(n)
2
3
4
5______________________________________________________________________________
6
8 tk_messageBox - pops up a message window and waits for user response.
9
11 tk_messageBox ?option value ...?
12______________________________________________________________________________
13
15 This procedure creates and displays a message window with an applica‐
16 tion-specified message, an icon and a set of buttons. Each of the but‐
17 tons in the message window is identified by a unique symbolic name (see
18 the -type options). After the message window is popped up, tk_message‐
19 Box waits for the user to select one of the buttons. Then it returns
20 the symbolic name of the selected button.
21
22 The following option-value pairs are supported:
23
24 -command string
25 Specifies the prefix of a Tcl command to invoke when the user
26 closes the dialog. The actual command consists of string fol‐
27 lowed by a space and the name of the button clicked by the user
28 to close the dialog. This is only available on Mac OS X.
29
30 -default name
31 Name gives the symbolic name of the default button for this mes‐
32 sage window ( “ok”, “cancel”, and so on). See -type for a list
33 of the symbolic names. If this option is not specified, the
34 first button in the dialog will be made the default.
35
36 -detail string
37 Specifies an auxiliary message to the main message given by the
38 -message option. The message detail will be presented beneath
39 the main message and, where supported by the OS, in a less
40 emphasized font than the main message.
41
42 -icon iconImage
43 Specifies an icon to display. IconImage must be one of the fol‐
44 lowing: error, info, question or warning. If this option is not
45 specified, then the info icon will be displayed.
46
47 -message string
48 Specifies the message to display in this message box. The
49 default value is an empty string.
50
51 -parent window
52 Makes window the logical parent of the message box. The message
53 box is displayed on top of its parent window.
54
55 -title titleString
56 Specifies a string to display as the title of the message box.
57 This option is ignored on Mac OS X, where platform guidelines
58 forbid the use of a title on this kind of dialog.
59
60 -type predefinedType
61 Arranges for a predefined set of buttons to be displayed. The
62 following values are possible for predefinedType:
63
64 abortretryignore Displays three buttons whose symbolic names
65 are abort, retry and ignore.
66
67 ok Displays one button whose symbolic name is ok.
68
69 okcancel Displays two buttons whose symbolic names are
70 ok and cancel.
71
72 retrycancel Displays two buttons whose symbolic names are
73 retry and cancel.
74
75 yesno Displays two buttons whose symbolic names are
76 yes and no.
77
78 yesnocancel Displays three buttons whose symbolic names
79 are yes, no and cancel.
80
82 set answer [tk_messageBox -message "Really quit?" \
83 -icon question -type yesno \
84 -detail "Select \"Yes\" to make the application exit"]
85 switch -- $answer {
86 yes exit
87 no {tk_messageBox -message "I know you like this application!" \
88 -type ok}
89 }
90
92 message box
93
94
95
96Tk 4.2 tk_messageBox(n)