Hello,
I got this to work by creating the menu outside of the subroutine, then calling the menu inside of the subroutine. Here's what I mean:
use Win32::GUI ();
...
my $menu = Win32::GUI::Menu->new(-name => "TestMenu");
$menu->{"TestMenu"}->AddMenuItem(
-item => 0,
-id => 14,
-text => "Exit",
-onClick => sub { $win->Hide(); undef $win; exit(0); },
);
sub Tray_RightClick {
$win->TrackPopupMenu($menu->{"TestMenu"}, Win32::GUI::GetCursorPos());
return 1;
}
...
Hope this helps you...
~Morpheous1129