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;
}



Reply via email to