NAME
ttk_dialog - create a dialog box
SYNOPSIS
ttk::dialog pathname ?options...?
ttk::dialog::define dialogType ?options...?
DESCRIPTION
WIDGET-SPECIFIC OPTIONS
-title, undefined, undefined
-message, undefined, undefined
-detail, undefined, undefined
-command, undefined, undefined
-parent, undefined, undefined
-type, undefined, undefined
-icon, undefined, undefined
-buttons, undefined, undefined
-labels, undefined, undefined
-default, undefined, undefined
-cancel, undefined, undefined
WIDGET COMMANDS
ttk::dialog::clientframe dlg
PREDEFINED DIALOG TYPES
STOCK BUTTONS
EXAMPLE
SEE ALSO

NAME

ttk_dialog - create a dialog box

SYNOPSIS

ttk::dialog pathname ?options...?
ttk::dialog::define dialogType ?options...?

DESCRIPTION

A dialog box is a transient top-level window containing an icon, a short message, an optional, longer, detail message, and a row of command buttons. When the user presses any of the buttons, a callback function is invoked and then the dialog is destroyed.

Additional widgets may be added in the dialog client frame.

WIDGET-SPECIFIC OPTIONS

Command-Line Name: -title
Database Name: undefined
Database Class: undefined
Specifies a string to use as the window manager title.

Command-Line Name: -message
Database Name: undefined
Database Class: undefined
Specifies the message to display in this dialog.

Command-Line Name: -detail
Database Name: undefined
Database Class: undefined
Specifies a longer auxilliary message.

Command-Line Name: -command
Database Name: undefined
Database Class: undefined
Specifies a command prefix to be invoked when the user presses one of the command buttons. The symbolic name of the button is passed as an additional argument to the command. The dialog is dismissed after invoking the command.

Command-Line Name: -parent
Database Name: undefined
Database Class: undefined
Specifies a toplevel window for which the dialog is transient. If omitted, the default is the nearest ancestor toplevel. If set to the empty string, the dialog will not be a transient window.

Command-Line Name: -type
Database Name: undefined
Database Class: undefined
Specifies a built-in or user-defined dialog type. See PREDEFINED DIALOG TYPES, below.

Command-Line Name: -icon
Database Name: undefined
Database Class: undefined
Specifies one of the stock dialog icons, info, question, warning, error, auth, or busy. If set to the empty string (the defalt), no icon is displayed.

Command-Line Name: -buttons
Database Name: undefined
Database Class: undefined
A list of symbolic button names.

Command-Line Name: -labels
Database Name: undefined
Database Class: undefined
A dictionary mapping symbolic button names to textual labels. May be omitted if all the buttons are predefined.

Command-Line Name: -default
Database Name: undefined
Database Class: undefined
The symbolic name of the default button.

Command-Line Name: -cancel
Database Name: undefined
Database Class: undefined
The symbolic name of the "cancel" button. The cancel button is invoked if the user presses the Escape key and when the dialog is closed from the window manager. If -cancel is not specified, the dialog ignores window manager close commands (WM_DELETE_WINDOW).

WIDGET COMMANDS

ttk::dialog::clientframe dlg
Returns the widget path of the client frame. Other widgets may be added to the client frame. The client frame appears between the detail message and the command buttons.

PREDEFINED DIALOG TYPES

The -type option, if present, specifies default values for other options. ttk::dialog::define type options... specifies a new stock dialog type. The following stock dialog types are predefined:
ttk::dialog::define ok \
    -icon info -buttons {ok} -default ok
ttk::dialog::define okcancel \
    -icon info -buttons {ok cancel} -default ok -cancel cancel
ttk::dialog::define yesno \
    -icon question -buttons {yes no}
ttk::dialog::define yesnocancel \
    -icon question -buttons {yes no cancel} -cancel cancel
ttk::dialog::define retrycancel \
    -icon question -buttons {retry cancel} -cancel cancel

STOCK BUTTONS

The following ``stock'' symbolic button names have predefined labels: yes, no, ok, cancel, and retry.

It is not necessary to list these in the -labels dictionary.

EXAMPLE

proc saveFileComplete {button} {
    switch -- $button {
    	yes { # save file ... }
	no  { exit }
	cancel { # no-op }
    }
}

ttk::dialog .saveFileDialog \
    -title "Save file?" \
    -icon question \
    -message "Save file before closing?" \
    -detail "If you do not save the file, your work will be lost" \
    -buttons [list yes no cancel] \ 
    -labels [list yes "Save file" no "Don't save"] \
    -command saveFileComplete \
    ;

SEE ALSO

tk_messageBox, wm, toplevel
Copyright © 2005 Joe English
Copyright © 1995-1997 Roger E. Critchlow Jr.