Hi All,
Can anyone explain to me why I get the error:
Can't call method "g_bind" without a package or object reference at
C:\scripts\Error Code\listbox_error.pl line 17.
Whenever I run the following code. This is put together from a larger
program and if you take out the bind language you get the same basic
error on the curselection statement. This is driving me crazy at this
point.
use Tkx;
my $mw = Tkx::widget->new(".");
$mw->g_wm_title("Test Program");
(my $nb = $mw->new_ttk__notebook(-height => 768, -width =>
1024))->g_grid();
testtab1();
testtab2();
Tkx::MainLoop();
sub testtab1 {
$tab1 = $nb->new_ttk__frame(-padding => "10");
$userbox = $tab1->new_tk__listbox(-height => 20,
-listvariable=>\$cnames)->g_grid(-column=>1,-row=>1);
$userbox->g_bind("<<ListboxSelect>>", sub {GetSecurity()});
$nb->add($tab1, -text => 'Test Tab', -state=>'hidden');
}
@countrynames = ("Argentina", "Australia", "Belgium", "Brazil",
"Canada", "China", "Denmark",
"Finland", "France", "Greece", "India", "Italy", "Japan",
"Mexico", "Netherlands", "Norway", "Spain",
"Sweden", "Switzerland");
$cnames = ''; foreach $i (@countrynames) {$cnames = $cnames . ' {' . $i
. '}';};
sub GetSecurity {
my $u;
my @idx = $userbox->curselection;
if ($#idx==0) {
$u = $countrynames[$idx[0]];
}
print "$u\n";
}
Thanks immensely for any help.
Tony Bass
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs