.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dialog 3" .TH Dialog 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::Dialog \- Create modal dialog and wait for a response. .SH SYNOPSIS .IX Header "SYNOPSIS" \ \ \ \ \fR\f(CI$dialog\fR\fI\fR = \fI\fR\f(CI$parent\fR\fI\fR\->\fBDialog\fR(\fI\-option\fR => \fIvalue\fR, ... ); .SH DESCRIPTION .IX Header "DESCRIPTION" This procedure is part of the Tk script library \- its arguments describe a dialog box. After creating a dialog box, \fBDialog\fR 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. .PP While waiting for the user to respond, \fBDialog\fR sets a local grab. This prevents the user from interacting with the application in any way except to invoke the dialog box. See the \fBShow()\fR method. .SH OPTIONS .IX Header "OPTIONS" The following option/value pairs are supported: .IP \fB\-title\fR 4 .IX Item "-title" Text to appear in the window manager's title bar for the dialog. .IP \fB\-text\fR 4 .IX Item "-text" Message to appear in the top portion of the Dialog. .IP \fB\-bitmap\fR 4 .IX Item "-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. .IP \fB\-default_button\fR 4 .IX Item "-default_button" Text label string of the Button that displays the default ring. .IP \fB\-buttons\fR 4 .IX Item "-buttons" A reference to a list of Button label strings. Each \fIstring\fR specifies text to display in a Button, in order from left to right. .SH METHODS .IX Header "METHODS" .ie n .IP "\fR\fI$answer\fR\fI\fR = $dialog\->\fBShow(\fR?\-global?\fB)\fR;" 4 .el .IP "\fR\f(CI$answer\fR\fI\fR = \f(CW$dialog\fR\->\fBShow(\fR?\-global?\fB)\fR;" 4 .IX Item "$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 \fR\f(CI$answer\fR\fI\fR. If \fI\-global\fR is specified a global (rather than local) grab is performed. .Sp The actual Dialog is shown using the \fBPopup\fR method. Any other options supplied to \fBShow\fR are passed to \fBPopup\fR, and can be used to position the Dialog on the screen. Please read Tk::Popup for details. .SH "ADVERTISED WIDGETS" .IX Header "ADVERTISED WIDGETS" Because Tk::Dialog is a subclass of Tk::DialogBox it inherits all the advertised subwidgets of its superclass: e.g. "B_button\-text", where \&'button\-text' is a Button's \-text value. Additionally, Tk::Dialog advertises: .IP \fBmessage\fR 4 .IX Item "message" The dialog's Label widget containing the message text. .IP \fBbitmap\fR 4 .IX Item "bitmap" The dialog's Label widget containing the bitmap image. .SH EXAMPLE .IX Header "EXAMPLE" \&\fR\f(CI$dialog\fR\fI\fR = \fI\fR\f(CI$mw\fR\fI\fR\->\fBDialog\fR(\-text => 'Save File?', \-bitmap => 'question', \-title => 'Save File Dialog', \-default_button => 'Yes', \-buttons => [qw/Yes No Cancel/); .SH KEYWORDS .IX Header "KEYWORDS" bitmap, dialog, modal, messageBox