Re: Hlist
<[email protected]> Sat, 15 Apr 2006 19:11:01 -0700 (PDT)
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
--- Johan Meskens CS3 jmcs3 <[email protected]> wrote: > #This is perl, v5.8.7 built for > i486-linux-gnu-thread-multi > > hello > i am experiencing some trouble using the tk::hlist > in an application > i thought i was doing something wrong > but using someone else's example script i experience > the same problem > namely > , the browsecommand and command options don't > deliver anything to the > shift in the subroutine > > ############################################ > use warnings; > use strict; > use Tk; > > use Tk::HList; > my $message = 'nothing yet ...'; > my $mw = MainWindow->new; > $mw->title('Dialog'); > my $label = $mw->Label(-textvariable => \$message); > my $exit = $mw->Button(-text => 'Exit', > -command => [$mw => > 'destroy']); > my $hlist = $mw->Scrolled('HList', > -itemtype => 'text', > -separator => '/', > -selectmode => 'single', Changing these lines worked for me. Not sure why it didn't work the other way... -browsecmd => sub { my $text = shift; $message="You bro wsed $text" }, -command => sub { my $text = shift; $message="You chose $text" } Phil > -browsecmd => sub{ > browse()}, > -command => sub{ browse() } > ); > > my @dirs = qw(/ /home /home/joe /home/jane /usr > /usr/lib /usr/bin /usr/man > /usr/include /usr/local > /usr/local/lib /usr/local/bin > /usr/local/include > ); > $hlist->add($_, -text => $_) for @dirs; > $exit->pack(-side => 'bottom'); > $label->pack(-side => 'top'); > $hlist->pack; > MainLoop; > sub browse { > my $choice = shift; > $message = "You chose '$choice'"; > } > > > __END__ > > i get the error when i click or double click: > ' Use of uninitialized value in concatenation (.) or > string at .. > > thanks > jmcs3 > > > > -++**==--++**==--++**==--++**==--++**==--++**==--++**== > This message was posted through the Stanford campus > mailing list > server. If you wish to unsubscribe from this > mailing list, send the > message body of "unsubscribe ptk" to > [email protected] > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]