Oliver Schaedlich wrote:

> Greetings,
>
> 15.12.2003, [EMAIL PROTECTED] wrote:
>
> >$mw->>Button (-text=>"run",
> >         -command=> sub {test($rb_val,$bonobo,$oracleid)})
> > ->place(-x=>320,-y=>>250 ,-width=>75);
>
> thanks for your reply.
>
> I tried to adapt to your example:
>
> $main->Button
>     ( -text => 'Add',
>       -command => sub { add_item($var1, $var2) }
>     ) -> pack;
>
> but the output &add_item delivers looks more like hash references
> than the content of aforementioned variables:
>
> Added Tk::Entry=HASH(0x1c1956c) Tk::Entry=HASH(0x1c1e3a8)
>
> Is it possible to pass simple variables via Entry/Button in the
> first place, and if, how?
>
> Best regards,
> oliver.

What does perldoc Tk::Entry tell you?

Try something like this:

Greetings! E:\d_drive\perlStuff\JPEG>perl -w
use strict;
use warnings;

use Tk;
use Tk::Entry;

my $win = MainWindow->new(height => 150, -width => 250);
my $entry = $win->Entry(-width => 25)->pack;
my $button = $win->Button(-text => 'Click it, baby, click it!!!',
 command => [\&read_entry_and_print, $entry])->pack;
MainLoop;

sub read_entry_and_print {
  my $entry = shift;
  my $response = $entry->get();
  print "$response\n";
}

^Z
Okay, this is the string

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to