In this script timer not works. I know because event handler was never
executed (no output to console). But when I remove onTerminate
parameter when creating main window and use old event model
(mw_Terminate sub) then timer starts to work! Isn't it the bug?
No - I dont think so - try this:
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);
$mw->Show;
Win32::GUI::Dialog;
sub T1_Timer {
local $| = 1;
print "Handler starts";
my $flag = $mw->IsVisible();
if ($flag) {
$mw->Hide();
}
else {
$mw->Show();
}
print "Handler ends";
return 1;
}