Subject: | Tk::Widget complains about "is not a hash" at line 190 |
See attached for sample script.
When running the script against an older Tk, the script draws a window with a table of information and embedded widgets in some of the cells. After upgrading the Tk to the latest, this script no longer functions.
The perl versions used in testing where 5.8.1 and 5.8.4 build 810. The operating system used for testing was SuSE 9.0 (Linux 2.4.21-215-default). The version of the modules were:
Tk version 804.027
Tk::TableMatrix 1.01 and 1.1
Here's the error message being returned:
842d22c is not a hash at /usr/lib/perl5/site_perl/5.8.1/i586-linux-thread-multi/Tk/Widget.pm line 190.
Aborted
#!/usr/bin/perl
use Tk;
use Tk::BrowseEntry;
use Tk::TableMatrix;
use Data::Dumper qw( DumperX);
my $top = MainWindow->new;
my $arrayVar = {};
foreach my $row (0..20){
foreach my $col (0..10){
$arrayVar->{"$row,$col"} = "r$row, c$col";
}
}
my $t = $top->TableMatrix(-rows => 21, -cols => 11,
-width => 6, -height => 6,
-titlerows => 1, -titlecols => 1,
-variable => $arrayVar,
-selectmode => 'extended',
-resizeborders => 'both',
-titlerows => 1,
-titlecols => 1,
-bg => 'white'
);
$t->tagConfigure('active', -bg => 'gray90', -relief => 'sunken');
$t->tagConfigure( 'title', -bg => 'gray85', -fg => 'black', -relief => 'sunken');
my $l = $top->Checkbutton(-text => 'CheckButton');
$t->windowConfigure("3,3", -sticky => 's', -window => $l);
my $c = $top->BrowseEntry(-label => "Month:");
$c->insert("end", "January");
$c->insert("end", "February");
$c->insert("end", "March");
$c->insert("end", "April");
$c->insert("end", "May");
$c->insert("end", "June");
$c->insert("end", "July");
$c->insert("end", "August");
$c->insert("end", "September");
$c->insert("end", "October");
$c->insert("end", "November");
$c->insert("end", "December");
$t->windowConfigure("2,2", -sticky => 'ne', -window => $c);
$t->colWidth(2,20);
$t->colWidth(3,20);
$t->pack(-expand => 1, -fill => 'both');
Tk::MainLoop;