Hi,

Below is the script I have.
1. Listbox is suppose to have 0-99 lines. working
2. when user clicks on a line, it will highlight the line. working
3. when user clicks on a particular line, script will display the value of
that line to STDout. not working.

What happens is, it prints the value of the previous click!!!

Why? What is wrong?

Dan.



use strict;
use Tk;
require Tk::BrowseEntry;
require Tk::ROText;

my $mw = MainWindow->new( -bg=> "#404040", -borderwidth=> 0);
$mw->minsize( 100, 200 );


my $LB = $mw->Scrolled(
        "Listbox",
        -bg        => "#C0C0C0",
        -fg        => '#000000',
        -relief        => 'raised',
        -scrollbars    => 'e',
        -cursor        =>  'top_left_arrow',
    )->pack( -side => 'top', -expand => 1, -fill => 'both', );
$LB->bind('<Button-1>', sub { DoThis( $LB->get('active') ); } );

for (my $x=0; $x<100; $x++) {
    $LB->insert('end',$x);
}

sub DoThis {
    my $this = shift;
    print $this,"\n";
}

MainLoop;
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to