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 -default name
25 Name gives the symbolic name of the default button for this mes‐
26 sage window ( “ok”, “cancel”, and so on). See -type for a list
27 of the symbolic names. If this option is not specified, the
28 first button in the dialog will be made the default.
29
30 -detail string
31 Specifies an auxiliary message to the main message given by the
32 -message option. The message detail will be presented beneath
33 the main message and, where supported by the OS, in a less
34 emphasized font than the main message.
35
36 -icon iconImage
37 Specifies an icon to display. IconImage must be one of the fol‐
38 lowing: error, info, question or warning. If this option is not
39 specified, then the info icon will be displayed.
40
41 -message string
42 Specifies the message to display in this message box. The
43 default value is an empty string.
44
45 -parent window
46 Makes window the logical parent of the message box. The message
47 box is displayed on top of its parent window.
48
49 -title titleString
50 Specifies a string to display as the title of the message box.
51 This option is ignored on Mac OS X, where platform guidelines
52 forbid the use of a title on this kind of dialog.
53
54 -type predefinedType
55 Arranges for a predefined set of buttons to be displayed. The
56 following values are possible for predefinedType:
57
58 abortretryignore Displays three buttons whose symbolic names
59 are abort, retry and ignore.
60
61 ok Displays one button whose symbolic name is ok.
62
63 okcancel Displays two buttons whose symbolic names are
64 ok and cancel.
65
66 retrycancel Displays two buttons whose symbolic names are
67 retry and cancel.
68
69 yesno Displays two buttons whose symbolic names are
70 yes and no.
71
72 yesnocancel Displays three buttons whose symbolic names
73 are yes, no and cancel.
74
76 set answer [tk_messageBox -message "Really quit?" \
77 -icon question -type yesno \
78 -detail "Select \"Yes\" to make the application exit"]
79 switch -- $answer {
80 yes exit
81 no {tk_messageBox -message "I know you like this application!" \
82 -type ok}
83 }
84
86 message box
87
88
89
90Tk 4.2 tk_messageBox(n)