Commit | Line | Data |
---|---|---|
86530b38 AT |
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 describe a | |
23 | dialog box. | |
24 | After creating a dialog box, B<Dialog> waits for the user to | |
25 | select one of the buttons either by clicking on the button with the | |
26 | mouse or by typing return to invoke the default button (if any). | |
27 | Then it returns the text string of the selected button. | |
28 | ||
29 | While waiting for the user to respond, B<Dialog> sets a local | |
30 | grab. This prevents the user from interacting with the application | |
31 | in any way except to invoke the dialog box. See B<Show()> method. | |
32 | ||
33 | The following option/value pairs are supported: | |
34 | ||
35 | =over 4 | |
36 | ||
37 | =item B<-title> | |
38 | ||
39 | Text to appear in the window manager's title bar for the dialog. | |
40 | ||
41 | =item B<-text> | |
42 | ||
43 | Message to appear in the top portion of the dialog box. | |
44 | ||
45 | =item B<-bitmap> | |
46 | ||
47 | If non-empty, specifies a bitmap to display in the top portion of | |
48 | the dialog, to the left of the text. | |
49 | If this is an empty string then no bitmap is displayed in the dialog. | |
50 | ||
51 | =item B<-default_button> | |
52 | ||
53 | Text label string of the button that displays the default ring. | |
54 | ||
55 | =item B<-buttons> | |
56 | ||
57 | A reference to a list of button label strings. | |
58 | Each I<string> specifies text to display in a button, | |
59 | in order from left to right. | |
60 | ||
61 | =back | |
62 | ||
63 | =head1 METHODS | |
64 | ||
65 | =over 4 | |
66 | ||
67 | =item C<$answer = $dialog-E<gt>B<Show>(?-global?);> | |
68 | ||
69 | This method displays the dialog, waits for the user's response, and stores | |
70 | the text string of the selected button in C<$answer>. If I<-global> is | |
71 | specified a global (rather than local) grab is performed. | |
72 | ||
73 | =back | |
74 | ||
75 | =head1 EXAMPLE | |
76 | ||
77 | 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/); | |
78 | ||
79 | =head1 KEYWORDS | |
80 | ||
81 | bitmap, dialog, modal, messageBox | |
82 | ||
83 | =cut | |
84 |