| 1 |
|
| 2 |
=head1 NAME |
| 3 |
|
| 4 |
Tk::Dialog - Perl/Tk Dialog widget |
| 5 |
|
| 6 |
=for pm Tk/Dialog.pm |
| 7 |
|
| 8 |
=for category Popups and Dialogs |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
require Tk::Dialog; |
| 13 |
|
| 14 |
$DialogRef = $widget->Dialog( |
| 15 |
-title => $title, |
| 16 |
-text => $text, |
| 17 |
-bitmap => $bitmap, |
| 18 |
-default_button => $default_button, |
| 19 |
-buttons => [@button_labels], |
| 20 |
); |
| 21 |
|
| 22 |
$selected = $DialogRef->Show(?-global?); |
| 23 |
|
| 24 |
=head1 DESCRIPTION |
| 25 |
|
| 26 |
This is an OO implementation of `tk_dialog'. First, create all your B<Dialog> |
| 27 |
objects during program initialization. When it's time to use a dialog, |
| 28 |
invoke the C<Show> method on a dialog object; the method then displays the |
| 29 |
dialog, waits for a button to be invoked, and returns the text label of the |
| 30 |
selected button. |
| 31 |
|
| 32 |
A Dialog object essentially consists of two subwidgets: a Label widget for |
| 33 |
the bitmap and a Label wigdet for the text of the dialog. If required, you |
| 34 |
can invoke the `configure' method to change any characteristic of these |
| 35 |
subwidgets. |
| 36 |
|
| 37 |
Because a Dialog object is a Toplevel widget all the 'composite' base class |
| 38 |
methods are available to you. |
| 39 |
|
| 40 |
Advertised widgets: bitmap, message. |
| 41 |
|
| 42 |
=over 4 |
| 43 |
|
| 44 |
=item 1) |
| 45 |
|
| 46 |
Call the constructor to create the dialog object, which in turn returns |
| 47 |
a blessed reference to the new composite widget: |
| 48 |
|
| 49 |
require Tk::Dialog; |
| 50 |
|
| 51 |
$DialogRef = $widget->Dialog( |
| 52 |
-title => $title, |
| 53 |
-text => $text, |
| 54 |
-bitmap => $bitmap, |
| 55 |
-default_button => $default_button, |
| 56 |
-buttons => [@button_labels], |
| 57 |
); |
| 58 |
|
| 59 |
=over 4 |
| 60 |
|
| 61 |
=item * mw |
| 62 |
|
| 63 |
a widget reference, usually the result of a C<MainWindow-E<gt>new> call. |
| 64 |
|
| 65 |
=item * title |
| 66 |
|
| 67 |
Title to display in the dialog's decorative frame. |
| 68 |
|
| 69 |
=item * text |
| 70 |
|
| 71 |
Message to display in the dialog widget. |
| 72 |
|
| 73 |
=item * bitmap |
| 74 |
|
| 75 |
Bitmap to display in the dialog. |
| 76 |
|
| 77 |
=item * default_button |
| 78 |
|
| 79 |
Text label of the button that is to display the |
| 80 |
default ring (''signifies no default button). |
| 81 |
|
| 82 |
=item * button_labels |
| 83 |
|
| 84 |
A reference to a list of one or more strings to |
| 85 |
display in buttons across the bottom of the dialog. |
| 86 |
|
| 87 |
=back |
| 88 |
|
| 89 |
=item 2) |
| 90 |
|
| 91 |
Invoke the C<Show> method on a dialog object |
| 92 |
|
| 93 |
$button_label = $DialogRef->Show; |
| 94 |
|
| 95 |
This returns the text label of the selected button. |
| 96 |
|
| 97 |
(Note: you can request a global grab by passing the string C<-global> |
| 98 |
to the C<Show> method.) |
| 99 |
|
| 100 |
=back |
| 101 |
|
| 102 |
=head1 SEE ALSO |
| 103 |
|
| 104 |
Tk::DialogBox |
| 105 |
|
| 106 |
=head1 KEYWORDS |
| 107 |
|
| 108 |
window, dialog, dialogbox |
| 109 |
|
| 110 |
=head1 AUTHOR |
| 111 |
|
| 112 |
Stephen O. Lidie, Lehigh University Computing Center. 94/12/27 |
| 113 |
[email protected] (based on John Stoffel's idea). |
| 114 |
|
| 115 |
=cut |
| 116 |
|