NAME
Tk::Dialog - Create modal dialog and wait for a response.
SYNOPSIS
$dialog = $parent->Dialog(-option => value, ... );
DESCRIPTION
This procedure is part of the Tk script library - its arguments describe a dialog box. After creating a dialog box, Dialog waits for the user to select one of the buttons either by clicking on the button with the mouse or by typing return to invoke the default button (if any). Then it returns the text string of the selected button.
While waiting for the user to respond, Dialog sets a local grab. This prevents the user from interacting with the application in any way except to invoke the dialog box. See Show() method.
The following option/value pairs are supported:
- -title
-
Text to appear in the window manager's title bar for the dialog.
- -text
-
Message to appear in the top portion of the dialog box.
- -bitmap
-
If non-empty, specifies a bitmap to display in the top portion of the dialog, to the left of the text. If this is an empty string then no bitmap is displayed in the dialog.
-
Text label string of the button that displays the default ring.
-
A reference to a list of button label strings. Each string specifies text to display in a button, in order from left to right.
METHODS
$answer = $dialog->Show(?-global?);
-
This method displays the dialog, waits for the user's response, and stores the text string of the selected button in
$answer
. If -global is specified a global (rather than local) grab is performed.
EXAMPLE
$dialog = $mw->Dialog(-text => 'Save File?', -bitmap => 'question', -title => 'Save File Dialog', -default_button => 'Yes', -buttons => [qw/Yes No Cancel/);
KEYWORDS
bitmap, dialog, modal, messageBox