Tk-EntryDialog
view release on metacpan or search on metacpan
EntryDialog.pm view on Meta::CPAN
}
sub textlabel {
my $w = $_[0];
my $text = $_[1];
if (defined $text and length ($text)) {
my $l1 = $w->Component (Label => 'textlabel',
-textvariable => \$w->{Configure}{-textlabel},
-font => $w -> {Configure}{-font});
$l1->grid( -column => 1, -row => 1, -padx => 5, -pady => 5,
-sticky => 'ew', -columnspan => 5 );
$w->Advertise('textlabel' => $l1);
$w -> Subwidget ('entry') ->
grid ( -column => 1, -row => 2, -padx => 5, -pady => 5,
-sticky => 'ew', -columnspan => 5 );
$w -> Subwidget ('acceptbutton') ->
grid( -column => 2, -row => 3, -padx => 5, -pady => 5,
-sticky => 'new' );
$w -> Subwidget ('cancelbutton') ->
grid ( -column => 4, -row => 3, -padx => 5, -pady => 5,
-sticky => 'new' );
} else {
$w -> Subwidget ('textlabel') -> destroy if
defined $w -> Subwidget ('textlabel');
}
EntryDialog.pm view on Meta::CPAN
-accept => ['PASSIVE',undef,undef,0] );
my $row = 1;
$w -> withdraw;
$row++ if (defined $args->{-textlabel} and length ($args->{-textlabel}));
my $e1 = $w -> Component (Entry => 'entry',
-textvariable => \$w->{Configure}{-defaultentry});
$e1 -> grid ( -column => 1, -row => $row++, -padx => 5, -pady => 5,
-sticky => 'ew', -columnspan => 5 );
$w -> Advertise ('entry' => $e1);
$e1 -> bind ('<Return>', sub {$w -> Accept});
my $b1 = $w -> Component (Button => 'acceptbutton',
-text => 'Accept',
-default => 'active' );
$b1->grid( -column => 2, -row => $row, -padx => 5, -pady => 5, -sticky => 'new' );
$b1 -> bind ('<Button-1>', sub {$w -> Accept});
$b1->focus;
my $b2 = $w -> Component (Button => 'cancelbutton',
-text => 'Cancel',
( run in 0.226 second using v1.01-cache-2.11-cpan-a5abf4f5562 )