You were close to getting this to work. He's your T1_Timer sub:
sub T1_Timer {
if ($trigger % 2) {
$ni->Change(-icon => $icon_yes,
-id => 100);
$mw->Enable();
$mw->Show();
$mw->Restore() if $mw->IsIconic();
}
else {
$ni->Change(-icon => $icon_no,
-id => 100);
$mw->CloseWindow() unless $mw->IsIconic();
$mw->Hide();
$mw->Disable();
}
$trigger++;
}
Brian Millham
This message traveled at least 44,000 miles to reach you!
Creator of the DW6000 Monitor
http://www.millham.net/dw6000
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ñåðãåé ×åðíèåíêî
Sent: Friday, August 12, 2005 9:28 AM
To: [email protected]
Subject: [perl-win32-gui-users] changing notify icon
Здравствуйте, perl-win32-gui-users,
My goal in script below is change tray icon of NotifyIcon object in
runtime on timer event. Icon stays unchanged. Why it is? How can I
change icon in other way?
use strict;
use Win32::GUI;
my $trigger = 0;
my $mw = Win32::GUI::Window->new(-name => 'mw',
-size => [400, 400],
-pos => [200, 200],
-title => "FormsTest",
-onTerminate => sub{return -1;},
-onTimer => \&T1_Timer,
-onMinimize => sub{my $self = shift;
$self->Hide();
$self->Disable();},
);
my $icon_no = Win32::GUI::Icon->new('no!.ico');
my $icon_yes = Win32::GUI::Icon->new('yes!.ico');
my $ni = $mw->AddNotifyIcon(-icon => $icon_yes,
-id => 100,
-onClick => sub{$mw->Enable(); $mw->Show();
$mw->Restore();}
);
my $t1 = Win32::GUI::Timer->new($mw, 'T1', 2000);
$mw->Disable();
Win32::GUI::Dialog;
sub T1_Timer {
if ($trigger % 2) {
$ni->Change(-icon => $icon_yes);
$mw->Enable();
$mw->Show();
$mw->Restore() if $mw->IsIconic();
}
else {
$ni->Change(-icon => $icon_no);
$mw->CloseWindow() unless $mw->IsIconic();
$mw->Hide();
$mw->Disable();
}
$trigger++;
}
__END__
Thanks!
--
С уважением,
Сергей mailto:[EMAIL PROTECTED]
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 0532-5, 08/12/2005
Tested on: 8/12/2005 6:03:31 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0532-5, 08/12/2005
Tested on: 8/12/2005 6:31:13 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com