The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tk::EntryDialog - Dialog widget with text entry.

SYNOPSIS

  use Tk;
  use Tk::EntryDialog;

  $d = $w -> EntryDialog ( -font => '*-helvetica-medium-r-*-*-12-*',
			   -title => 'Text Entry',
			   -textlabel => 'Please enter your text:',
                           -defaultentry => 'Text in entry widget' );
  $d -> WaitForInput;

DESCRIPTION

  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:

    use Tk;
    use Tk::EntryDialog;

    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;

VERSION

$Revision: 0.10 $

Licensed for free distribution under the terms of the 
Perl Artistic License.

Written by Robert Allan Kiesling <rkiesling@earthlink.net>.

Dave Scheck <cds033@email.mot.com> provided the input for the 
-textlabel option.