Can you explain how the -ontimer option works?
-onTimer => \&T1_Timer,

Using -ontimer, how do you set how often it kicks off?

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jeremy White
Sent: Thursday, August 04, 2005 8:02 AM
To: [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net
Subject: RE: Re[2]: [perl-win32-gui-users] working/not working timer



>Yes, it works. But what if I need 2 timers? And does it mean that OEM 
>and NEM can not be mixed?

The event handler receives two parameters, the first is the window, the 
second is the name of the timer. See code below to see how this works.
As 
for OEM/NEM - you can mix them sometimes, but I wouldn't recommend doing
it. 
Out of the two, NEM is much more flexible - and faster too.

Cheers,

jez.

use strict;
use Win32::GUI;


my $mw = Win32::GUI::Window->new(-name => 'mw',
-size => [400, 400],
-pos => [200, 200],
-title => "FormsTest",
-onTerminate => sub{return -1;},
-onTimer => \&T1_Timer,
);


my $t1 = Win32::GUI::Timer->new($mw, 'T1', 2000);
my $t2 = Win32::GUI::Timer->new($mw, 'T2', 500);

$mw->Show;
Win32::GUI::Dialog;

sub T1_Timer {
my ($win,$timer)[EMAIL PROTECTED];
if ($timer eq 'T1') {
  local $| = 1;
  print "Handler starts";
  my $flag = $mw->IsVisible();
  if ($flag) {
  $mw->Hide();
  }
  else {
  $mw->Show();
  }
  print "Handler ends";
}
if ($timer eq 'T2') {
  print "T2 timer\n";
}
return 1;
}




-------------------------------------------------------
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
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

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.



Reply via email to