The -font option defaults to helvetica 12
The -textlabel option prints the text of its argument in label above
the text entry box.
After WaitForInput is called, clicking on the
'Accept'
button closes the dialog
and returns the text in the entry box.
The WaitForInput method does not destroy the dialog window. Instead
WaitForInput unmaps the dialog box from the display. To de-allocate
the widget, you must explicitly call
$w
-> destroy or
$w
-> DESTROY.
Refer to the Tk::options man page
for
a description of options
common to all Perl/Tk widgets.
Example:
my
$w
= new MainWindow;
my
$b
=
$w
-> Button (
-text
=>
'Dialog'
,
-command
=>
sub
{
&show_dialog
(
$w
)}) ->
pack
;
sub
show_dialog {
my
(
$w
) =
@_
;
my
$e
;
if
(not
defined
$e
) {
$e
=
$w
-> TextDialog (
-title
=>
'Enter Text'
,
-height
=>5,
-width
=>20);
$e
-> configure (
-textlabel
=>
'Please enter your text:'
);
}
my
$resp
=
$e
-> WaitForInput;
print
"$resp\n"
;
$e
-> configure (
-textlabel
=>
''
);
my
$resp
=
$e
-> WaitForInput;
print
"$resp\n"
;
return
$resp
;
}
MainLoop;