On Sun, 07 Apr 2002 13:54:40 -0400, zentara <[EMAIL PROTECTED]> wrote:

>On Fri, 5 Apr 2002 16:59:00 -0800 , [EMAIL PROTECTED] (Timothy Johnson)
>wrote:
>
>>
>>Hey, is there anybody out there than can give me a really short example of
>>retrieving text from an Entry box?  I see in the documentation that you use
>>the $entry-gtget, but there aren't any syntax examples.

Ooops, here's one that actually uses Entry. :-)

#!/usr/bin/perl
use Tk;

my $mw = MainWindow->new;
my $entry = $mw->Entry->pack;
my $button = $mw->Button(
-text => "Submit",
-command => sub {
my $eValue = $entry->get();

## Don't do anything unless there is a value in the
## entry widget
return
unless length($eValue) > 0;

## Otherwise, create and show a message dialog asking if
## if the value is good or not
my $bValue = $mw->messageBox(
-type => "YesNo",
-title => "Submit Dialog",
-icon => "question",
-default => "yes",
-message => "You have entered the following value: $eValue. "  .
"Is this acceptable?"
);

## If the value was good, print it out, otherwise,
## clear the entry
if (lc($bValue) eq "yes") {
print $eValue . " was accepted\n";
} else {
$entry->delete(0, "end");
}
})->pack;

MainLoop;





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to