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
14
16 This procedure creates and displays a message window with an applica‐
17 tion-specified message, an icon and a set of buttons. Each of the but‐
18 tons in the message window is identified by a unique symbolic name (see
19 the -type options). After the message window is popped up, tk_message‐
20 Box waits for the user to select one of the buttons. Then it returns
21 the symbolic name of the selected button.
22
23 The following option-value pairs are supported:
24
25 -default name
26 Name gives the symbolic name of the default button for this mes‐
27 sage window ( “ok”, “cancel”, and so on). See -type for a list
28 of the symbolic names. If this option is not specified, the
29 first button in the dialog will be made the default.
30
31 -detail string
32 Specifies an auxiliary message to the main message given by the │
33 -message option. Where supported by the underlying OS, the mes‐ │
34 sage detail will be presented in a less emphasized font than the │
35 main message.
36
37 -icon iconImage
38 Specifies an icon to display. IconImage must be one of the fol‐
39 lowing: error, info, question or warning. If this option is not
40 specified, then the info icon will be displayed.
41
42 -message string
43 Specifies the message to display in this message box.
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 The default value is an empty string.
52
53 -type predefinedType
54 Arranges for a predefined set of buttons to be displayed. The
55 following values are possible for predefinedType:
56
57 abortretryignore Displays three buttons whose symbolic names
58 are abort, retry and ignore.
59
60 ok Displays one button whose symbolic name is ok.
61
62 okcancel Displays two buttons whose symbolic names are
63 ok and cancel.
64
65 retrycancel Displays two buttons whose symbolic names are
66 retry and cancel.
67
68 yesno Displays two buttons whose symbolic names are
69 yes and no.
70
71 yesnocancel Displays three buttons whose symbolic names
72 are yes, no and cancel.
73
75 set answer [tk_messageBox -message "Really quit?" \
76 -icon question -type yesno \
77 -detail "Select \"Yes\" to make the application exit"]
78 switch -- $answer {
79 yes exit
80 no {tk_messageBox -message "I know you like this application!" \
81 -type ok}
82 }
83
84
86 message box
87
88
89
90Tk 4.2 tk_messageBox(n)