Ace128 has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks, Well, I dont get why the SystrayExit_Click function aint called here:
#!/usr/bin/perl use warnings; use strict; use Win32::GUI; my $mw_win32; &do_win32_stuff; sub do_win32_stuff{ $mw_win32 = new Win32::GUI::Window( -width => 0, -height => 0, -name => 'MainWindow'); my $icon = new Win32::GUI::Icon('icon.ico'); new Win32::GUI::NotifyIcon($mw_win32, -name => "SysTray", -id => 1, -icon => $icon, -tip => "I\'am in the Systray!"); my $call = Win32::GUI::Dialog(); $mw_win32->Notify->Delete(-id => 1); } sub SysTray_RightClick { my $systray_menu = new Win32::GUI::Menu( "SystrayMenu Functions" => "SystrayMenu", "> Info" => "SystrayInfo", "> Exit" => "SystrayExit" ); my($x, $y) = Win32::GUI::GetCursorPos(); $mw_win32->TrackPopupMenu($systray_menu->{SystrayMenu}, $x, $y); 1; } sub SystrayExit_Click { print "WORK FOR GOD SAKE!!\n"; exit; } sub Main_Terminate { Win32::GUI::NotifyIcon::Delete( $mw_win32, -id => 1 ); return -1; } sub SysTray_Terminate { Win32::GUI::NotifyIcon::Delete( $mw_win32, -id => 1 ); return -1; } sub Main_Minimize { $mw_win32->Disable(); $mw_win32->Hide(); 1; }
What am I missing? Im using Win32::GUI v1.0 btw.
(Win32-GUI-1.0-PPM-5.8.zip)

Thanks,
Ace

Replies are listed 'Best First'.
Re: Functions aint called using Win32::GUI::NotifyIcon
by Ace128 (Hermit) on Jun 15, 2005 at 00:05 UTC
    Bah, I just moved the "my $systray_menu ..." out to be global, and it worked better... Still dont get why, but I guess its something internal (not finding function because of some wierdo reason)...
Re: Functions aint called using Win32::GUI::NotifyIcon
by monarch (Priest) on Jun 15, 2005 at 00:14 UTC
    Does the SystrayInfo function get called when you click on the "Info" option?
      Uh, no. Ignore that. :) But it works if I put that outside as I mentioned earlier...