The -font option defaults to *-helvetica-medium-r-*-*-12-*.
The -defaultentry option supplies the
default
text in the Entry
widget.
The -textlabel option prints the text of its argument in label above
the text entry box.
After WaitForEntry is called, clicking on the
'Accept'
button or
pressing Enter in the text entry widget, closes the dialog and returns
the text in the entry box.
The WaitForEntry method does not destroy the dialog window. Instead
WaitForEntry 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
-> EntryDialog (
-title
=>
'Enter Text'
);
$e
-> configure (
-defaultentry
=>
'Default text'
);
$e
-> configure (
-textlabel
=>
'Please enter your text:'
);
}
my
$resp
=
$e
-> WaitForInput;
print
"$resp\n"
;
$e
-> configure (
-textlabel
=>
''
);
$e
-> configure (
-defaultentry
=>
'New entry without label.'
);
my
$resp
=
$e
-> WaitForInput;
print
"$resp\n"
;
return
$resp
;
}
MainLoop;