I am trying to create a hierchical optionmenu system. I have an array for my first options, and hashes of arrays for my second and third options where the index of the array is the choice from the previous menu. Whenever I try to update the options, I get an error though. The program when coded as follows doesnt even run. I am sure that I am making some dumb mistake, but I would really appreciate any help someone could give. The error I get is "Tk::Error: Can't set -options to `ARRAY(0x2eee778)' for Tk::Optionmenu=HASH(0x2ef4e78): Can 't call method "configure" on an undefined value" CKP2.txt is a file of the form "key+option1+option2+option3+...\n key2+option1..." Thank you all for all of your help.

#!/usr/local/bin/perl
use Tk;
use Tk::Optionmenu;


open(IN,"CKP1.txt"); @primary=<IN>; foreach $item(@primary){chomp $item;} close IN;

open(IN2,"CKP2.txt");
@secondary=<IN2>;
foreach $item(@secondary){chomp $item;};
foreach $item(@secondary){
   @temp=split/\+/,$item;
   $key=$temp[0];
   $temp[0]="";
   @temp=grep $_ ne "",@temp;
   [EMAIL PROTECTED];}
close IN2;

$mw = MainWindow->new();

$mw->Label(-text=>"abe")->grid(-column=>1, -row=>1,-sticky=>w);
$mw->Label(-text=>"a package about abes")->grid(-column=>1, -row=>2,-columnspan=>7, -sticky=>w);


$fih=$mw->Optionmenu(-variable=>\$abekw1, -options => [EMAIL PROTECTED], -command=>\&SETOPS) -> grid(-column=>2, -row=>1, -columnspan=>2);
$gih=$mw->Optionmenu(-variable=>\$abekw2, -options => [EMAIL PROTECTED]) -> grid(-column=>4, -row=>1, -columnspan=>2);


sub [EMAIL PROTECTED]@{second{$abekw1}};
   $gih->configure(-options=>[EMAIL PROTECTED])}

MainLoop();

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to