| 1 |
# Copyright (c) 1992 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk::Dialog - Create modal dialog and wait for a response. |
| 11 |
|
| 12 |
=for pm Tk/Dialog.pm |
| 13 |
|
| 14 |
=for category Popups and Dialogs |
| 15 |
|
| 16 |
=head1 SYNOPSIS |
| 17 |
|
| 18 |
S< >I<$dialog> = I<$parent>-E<gt>B<Dialog>(I<-option> =E<gt> I<value>, ... ); |
| 19 |
|
| 20 |
=head1 DESCRIPTION |
| 21 |
|
| 22 |
This procedure is part of the Tk script library - its arguments |
| 23 |
describe a dialog box. After creating a dialog box, B<Dialog> waits |
| 24 |
for the user to select one of the Buttons either by clicking on the |
| 25 |
Button with the mouse or by typing return to invoke the default Button |
| 26 |
(if any). Then it returns the text string of the selected Button. |
| 27 |
|
| 28 |
While waiting for the user to respond, B<Dialog> sets a local |
| 29 |
grab. This prevents the user from interacting with the application |
| 30 |
in any way except to invoke the dialog box. See the B<Show()> method. |
| 31 |
|
| 32 |
=head1 OPTIONS |
| 33 |
|
| 34 |
The following option/value pairs are supported: |
| 35 |
|
| 36 |
=over 4 |
| 37 |
|
| 38 |
=item B<-title> |
| 39 |
|
| 40 |
Text to appear in the window manager's title bar for the dialog. |
| 41 |
|
| 42 |
=item B<-text> |
| 43 |
|
| 44 |
Message to appear in the top portion of the Dialog. |
| 45 |
|
| 46 |
=item B<-bitmap> |
| 47 |
|
| 48 |
If non-empty, specifies a bitmap to display in the top portion of the |
| 49 |
Dialog, to the left of the text. If this is an empty string then no |
| 50 |
bitmap is displayed in the Dialog. |
| 51 |
|
| 52 |
=item B<-default_button> |
| 53 |
|
| 54 |
Text label string of the Button that displays the default ring. |
| 55 |
|
| 56 |
=item B<-buttons> |
| 57 |
|
| 58 |
A reference to a list of Button label strings. Each I<string> |
| 59 |
specifies text to display in a Button, in order from left to right. |
| 60 |
|
| 61 |
=back |
| 62 |
|
| 63 |
=head1 METHODS |
| 64 |
|
| 65 |
=over 4 |
| 66 |
|
| 67 |
=item I<$answer> = $dialog-E<gt>B<Show(>?-global?B<)>; |
| 68 |
|
| 69 |
This method displays the Dialog, waits for the user's response, and stores |
| 70 |
the text string of the selected Button in I<$answer>. If I<-global> is |
| 71 |
specified a global (rather than local) grab is performed. |
| 72 |
|
| 73 |
The actual Dialog is shown using the B<Popup> method. Any other |
| 74 |
options supplied to B<Show> are passed to B<Popup>, and can be used to |
| 75 |
position the Dialog on the screen. Please read Tk::Popup for details. |
| 76 |
|
| 77 |
=back |
| 78 |
|
| 79 |
=head1 ADVERTISED WIDGETS |
| 80 |
|
| 81 |
Because Tk::Dialog is a subclass of Tk::DialogBox it inherits all the |
| 82 |
advertised subwidgets of its superclass: e.g. "B_button-text", where |
| 83 |
'button-text' is a Button's -text value. Additionally, Tk::Dialog |
| 84 |
advertises: |
| 85 |
|
| 86 |
=over 4 |
| 87 |
|
| 88 |
=item B<message> |
| 89 |
|
| 90 |
The dialog's Label widget containing the message text. |
| 91 |
|
| 92 |
=item B<bitmap> |
| 93 |
|
| 94 |
The dialog's Label widget containing the bitmap image. |
| 95 |
|
| 96 |
=back |
| 97 |
|
| 98 |
=head1 EXAMPLE |
| 99 |
|
| 100 |
I<$dialog> = I<$mw>-E<gt>B<Dialog>(-text =E<gt> 'Save File?', -bitmap =E<gt> 'question', -title =E<gt> 'Save File Dialog', -default_button =E<gt> 'Yes', -buttons =E<gt> [qw/Yes No Cancel/); |
| 101 |
|
| 102 |
=head1 KEYWORDS |
| 103 |
|
| 104 |
bitmap, dialog, modal, messageBox |
| 105 |
|
| 106 |
=cut |
| 107 |
|