From: Ceres <ce...@ce...> - 2002-06-19 17:34:55
|
## ______ ## ## $subname =3D "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 =3D "Menu$key\_Click"; or $subname =3D "Menu$key"."_Click"; Grretings Ceres *********** REPLY SEPARATOR *********** On 18-6-2002 at 12:11 per...@li...= 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 <jso...@al...> > Subject: [perl-win32-gui-users] Creating menu's "on-the-fly" > > Can anyone see anything I am doing wrong? > > # define main menu > my $MainMenu =3D new Win32::GUI::Menu( > "&File" =3D> "File", > " > E&xit" =3D> "FileExit", > "&Message" =3D> "Message", > " > &Add New" =3D> "AddMessage", > " > &Edit" =3D> "EditMessage", > " > &Delete" =3D> "DeleteMessage", > " > -" =3D> 0, > @MENUDEF, > "&Tools" =3D> "Tools", > " > &Setup" =3D> "Setup", > " > -" =3D> 0, > " > Change &Password" =3D> "ChangePassword", > "&Help" =3D> "Help", > " > &About" =3D> "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 =3D (); > 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 =3D "Menu${key}_Click"; > *$subname =3D 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 |