[perl-win32-gui-users] Creating menu's "on-the-fly"

2002-06-18 Thread Jonathan Southwick
I have a file that contains some information that is used to create a menu, 
almost like a Recently Opened Files list.  I tried using the code from the 
podview,pl sample but it is not working for me.  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




Fwd: Re: [perl-win32-gui-users] Creating menu's "on-the-fly"

2002-06-18 Thread Jonathan Southwick

From: "Aldo Calpini" <[EMAIL PROTECTED]>
To: ,
"Jonathan Southwick" <[EMAIL PROTECTED]>
Subject: Re: [perl-win32-gui-users] Creating menu's "on-the-fly"
Date: Tue, 18 Jun 2002 17:35:23 +0200
X-Mailer: Microsoft Outlook Express 5.50.4807.1700

Jonathan Southwick wrote:
> I have a file that contains some information that is used to create a
menu,
> almost like a Recently Opened Files list.  I tried using the code from the
> podview,pl sample but it is not working for me.  Can anyone see anything I
> am doing wrong?
>
> [...]
>*$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;
>   }
>));

if you're using qq() to quote the sub, you need to escape sigils:

   \$MainWindow->Message->Text(\$MESSAGE{\$key});

NOTE: please forward this msg to the mailing list, because SourceForge
is refusing to receive mail from me :-(

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;


Jonathan Southwick
[EMAIL PROTECTED]
Technical & Network Services
Allegheny College, Meadville, PA 16335
(814) 332-2755




Re: [perl-win32-gui-users] Creating menu's "on-the-fly"

2002-06-18 Thread Jonathan Southwick

Thanks Aldo.  It works now.

Jonathan

At 6/18/2002 05:35 PM, you wrote:

Jonathan Southwick wrote:
> I have a file that contains some information that is used to create a
menu,
> almost like a Recently Opened Files list.  I tried using the code from the
> podview,pl sample but it is not working for me.  Can anyone see anything I
> am doing wrong?
>
> [...]
>*$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;
>   }
>));

if you're using qq() to quote the sub, you need to escape sigils:

   \$MainWindow->Message->Text(\$MESSAGE{\$key});

NOTE: please forward this msg to the mailing list, because SourceForge
is refusing to receive mail from me :-(

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;