##                 ______         ##
## $subname = "Menu${key}_Click"; ##
##                 ^^^^^^         ##

is this working  ?
scalar $key is a string and has a value
but does ${key} have the same value then?
isn't it interpated as a hash in stead of a scalar?

i mostly use:
  $subname = "Menu$key\_Click";
or
  $subname = "Menu$key"."_Click";

Grretings
  Ceres

*********** REPLY SEPARATOR  ***********

On 18-6-2002 at 12:11 [EMAIL PROTECTED] wrote:

 > Today's Topics:
 >
 >    1. Creating menu's "on-the-fly" (Jonathan Southwick)
 >    2. Fwd: Re: [perl-win32-gui-users] Creating menu's "on-the-fly" (Jonathan 
 > Southwick)
 >    3. Re: Creating menu's "on-the-fly" (Jonathan Southwick)
 >
 > --__--__--
 >
 > Message: 1
 > From: Jonathan Southwick <[EMAIL PROTECTED]>
 > Subject: [perl-win32-gui-users] Creating menu's "on-the-fly"
 >
 > Can anyone see anything I  am doing wrong?
 >
 > # define main menu
 > my $MainMenu = new Win32::GUI::Menu(
 >      "&File" => "File",
 >      "   >   E&xit" => "FileExit",
 >      "&Message" => "Message",
 >      "   >   &Add New" => "AddMessage",
 >      "   >   &Edit" => "EditMessage",
 >      "   >   &Delete" => "DeleteMessage",
 >      "   >   -" => 0,
 >      @MENUDEF,
 >      "&Tools" => "Tools",
 >      "   >   &Setup" => "Setup",
 >      "   >   -" => 0,
 >      "   >   Change &Password" => "ChangePassword",
 >      "&Help" => "Help",
 >      "   >   &About" => "About",
 > );
 >
 >
 > ### I call this routine *before* I create my menu.
 > sub getMessageList {
 >   ### stuff deleted, this section just read in the file and created the has
 >   ### now I want to use the values in the hash for my menu.
 >     @MENUDEF = ();
 >     foreach $key (keys (%MESSAGE)) {
 >        print "$key is text: $MESSAGE{$key}\n";
 >      ## this is only for testing purposes to make
 >      ## sure I have the right information
 >        push(@MENUDEF," > $key");
 >        push(@MENUDEF,"Menu$key");
 >        $subname = "Menu${key}_Click";
 >        *$subname = eval(qq(
 >           sub {
 >              print "got a click\n"; ## this is for testing, but I don't get 
 > a click
 >              $MainWindow->Message->Text($MESSAGE{$key});
 >              return;
 >           }
 >        ));
 >     }
 >     return;
 > }
 >
 >
 > Jonathan



Reply via email to