Steve Lloyd wrote:
Can anyone tell me how to capture the mousemove event on the notifyicon?
I have tried the following but to no avail.
----------------------
my $systray = $mw->AddNotifyIcon(
-icon => $icon,
-tip => $progname,
-onMouseEvent => \&systrayEvent,
);
-----------------
I also tried hooking the main window as follows:
$mw->Hook(WM_NOTIFYICON, \&systrayEvent);
This method captures all buy mousemove..
Steve,
I owe you an apology - I was too fast with closing your bug report at
the end of last week. There is indeed a problem with NEM events on the
NotifyIcon class. I have re-opened your bug report, and think this is a
serious enough problem that I am considering a 1.05 release to fix it.
In the mean time you can work around it by
- Using OEM events, or
- using the Change() method, after creation of the notify icon object to
set the event handler. The following works for me:
#!perl -w
use strict;
use warnings;
use Win32::GUI qw( WM_MOUSEMOVE );
my $mw = Win32::GUI::Window->new(
-size => [400,300],
);
my $ni = $mw->AddNotifyIcon();
$ni->Change(
-onMouseEvent => \&ni_event,
);
$mw->Show();
Win32::GUI::Dialog();
exit(0);
sub ni_event
{
my ($self, $name, $event) = @_;
if($event = WM_MOUSEMOVE) {
print "Mouse Move\n";
}
return 0;
}
__END__
Regards,
Rob.