Tk::HList oddity

Sean Kamath <[email protected]> Fri, 16 Jun 2006 17:40:07 -0700
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Hi all,

OK, here at work we've just run into a little bug with Tk::HList.

I've got a test case and everything.

If you comment out the line

my $cols = $cols_no_work;

(so that $cols  is 5, or "$cold_work"), you'll see the "correct"
behaviour (that is, clicking will produce "Browsing....", and double
clicking will product "Double....".).  Put it back or leave it in, and
you'll never see anything but "Browsing....".

perl 5.8.8 (and 5.8.6)
RHEL WS4U3 (and others)
$Tk::version     = '8.4';
$Tk::VERSION     = '804.027';

Any hints, suggestions, etc?

Sean

Here's the test code.

#!/usr/local/bin/perl

use Tk;
use Tk::HList;


my $cols_work = 5;
my $cols_no_work = 6;

# Set $cols = $cols_no_work to see this break.

my $cols = $cols_work;
my $cols = $cols_no_work;

my $win = new MainWindow;
my $hlist = $win->HList(
    -header => 1,
    -columns => $cols,
    -browsecmd => sub { print STDERR "Browsing....\n" },
    -command => sub { print STDERR "Double....\n" }
)->pack(
);
for ( my $hdr=0;$hdr<$cols;$hdr++ ) {
    $hlist->headerCreate( $hdr,
        -itemtype => window,
        -widget => $hlist->Label(-text => "header $hdr")
    );
}

$hlist->add("test");
$hlist->itemCreate( "test", 0, -text => "Testing" );
MainLoop();
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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]