1dialog(n) Tile Widget Set dialog(n)
2
3
4
6 ttk::dialog - create a dialog box
7
9 ttk::dialog pathname ?options...? ttk::dialog::define dialogType
10 ?options...?
11
13 A dialog box is a transient top-level window containing an icon, a
14 short message, an optional, longer, detail message, and a row of com‐
15 mand buttons. When the user presses any of the buttons, a callback
16 function is invoked and then the dialog is destroyed.
17
18 Additional widgets may be added in the dialog client frame.
19
21 [-title n/a] Specifies a string to use as the window manager title.
22 [-message n/a] Specifies the message to display in this dialog.
23 [-detail n/a] Specifies a longer auxilliary message. [-command n/a]
24 Specifies a command prefix to be invoked when the user presses one of
25 the command buttons. The symbolic name of the button is passed as an
26 additional argument to the command. The dialog is dismissed after
27 invoking the command. [-parent n/a] Specifies a toplevel window for
28 which the dialog is transient. If omitted, the default is the nearest
29 ancestor toplevel. If set to the empty string, the dialog will not be
30 a transient window. [-type n/a] Specifies a built-in or user-defined
31 dialog type. See PREDEFINED DIALOG TYPES, below. [-icon n/a] Speci‐
32 fies one of the stock dialog icons, info, question, warning, error,
33 auth, or busy. If set to the empty string (the defalt), no icon is
34 displayed. [-buttons n/a] A list of symbolic button names.
35 [-labels n/a] A dictionary mapping symbolic button names to textual
36 labels. May be omitted if all the buttons are predefined.
37 [-default n/a] The symbolic name of the default button. [-cancel n/a]
38 The symbolic name of the "cancel" button. The cancel button is invoked
39 if the user presses the Escape key and when the dialog is closed from
40 the window manager. If -cancel is not specified, the dialog ignores
41 window manager close commands (WM_DELETE_WINDOW).
42
44 ttk::dialog::clientframe dlg
45 Returns the widget path of the client frame. Other widgets may
46 be added to the client frame. The client frame appears between
47 the detail message and the command buttons.
48
50 The -type option, if present, specifies default values for other
51 options. ttk::dialog::define type options... specifies a new stock
52 dialog type. The following stock dialog types are predefined:
53 ttk::dialog::define ok \
54 -icon info -buttons {ok} -default ok ttk::dialog::define okcancel \
55 -icon info -buttons {ok cancel} -default ok -cancel cancel
56 ttk::dialog::define yesno \
57 -icon question -buttons {yes no} ttk::dialog::define yesnocancel \
58 -icon question -buttons {yes no cancel} -cancel cancel ttk::dia‐
59 log::define retrycancel \
60 -icon question -buttons {retry cancel} -cancel cancel
61
63 The following ``stock'' symbolic button names have predefined labels:
64 yes, no, ok, cancel, and retry.
65
66 It is not necessary to list these in the -labels dictionary.
67
69 proc saveFileComplete {button} {
70 switch -- $button {
71 yes { # save file ... } no { exit } cancel { # no-op }
72 } }
73
74 ttk::dialog .saveFileDialog \
75 -title "Save file?" \
76 -icon question \
77 -message "Save file before closing?" \
78 -detail "If you do not save the file, your work will be lost" \
79 -buttons [list yes no cancel] \
80 -labels [list yes "Save file" no "Don't save"] \
81 -command saveFileComplete \
82 ;
83
85 tk_messageBox(n), wm(n), toplevel(n)
86
87
88
89tile 0.7 dialog(n)