In answer to my own question, I guess you could base what the sub did on
the timer name.
So you could set one timer per day, hour, and minute that did different
things based on the name of the timer..
use strict;
use Win32::GUI;
my $mw = Win32::GUI::Window->new(
-name => 'mw',
-size => [400, 400],
-pos => [200, 200],
-onTerminate => sub{return -1;},
-onTimer => sub{my $name=$_[1];MyTimers($name);},
);
$mw->AddTimer('Slow', 2000);
$mw->AddTimer('Medium', 1000);
$mw->AddTimer('Quick', 500);
$mw->AddTimer('Very Quick', 250);
$mw->Show;
Win32::GUI::Dialog;
sub MyTimers{
my $timer=shift;
if($timer=~/^slow$/is){
print "running slow stuff\n";
}
elsif($timer=~/^medium$/is){
print "running medium stuff\n";
}
elsif($timer=~/^quick$/is){
print "running quick stuff\n";
}
elsif($timer=~/^very quick$/is){
print "running very quick stuff\n";
}
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Lloyd, Steve
Sent: Thursday, August 04, 2005 10:38 AM
To: Jeremy White; [EMAIL PROTECTED];
[email protected]
Subject: RE: Re[2]: [perl-win32-gui-users] working/not working timer
Yes it does. So, I guess I do not see its usefulness.
In your example the same sub would be kicked off multiple times at the
same time, right? How is this useful?
Milliseconds Timer Runs
250 once
500 twice
750 once
1000 three times
2000 four times
-----Original Message-----
From: Jeremy White [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 04, 2005 10:30 AM
To: Lloyd, Steve; [EMAIL PROTECTED];
[email protected]
Subject: RE: Re[2]: [perl-win32-gui-users] working/not working timer
>Can you explain how the -ontimer option works?
>-onTimer => \&T1_Timer,
The onTime is the event handler for all timers for a specific window. In
the
example below, we're adding 4 timers to the window. When the timer is
fired,
it's name is printed out. Does that help?
Cheers,
jez.
use strict;
use Win32::GUI;
my $mw = Win32::GUI::Window->new(
-name => 'mw',
-size => [400, 400],
-pos => [200, 200],
-onTerminate => sub{return -1;},
-onTimer => sub{print $_[1]."\n"},
);
$mw->AddTimer('Slow', 2000);
$mw->AddTimer('Medium', 1000);
$mw->AddTimer('Quick', 500);
$mw->AddTimer('Very Quick', 250);
$mw->Show;
Win32::GUI::Dialog;
This email, and any files previous email messages included with it, may
contain confidential and/or privileged material. If you are not the
intended recipient please contact the sender and delete all copies.
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Perl-Win32-GUI-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users