Question: is this a bug? The only alternate behaviour I can come up with is that SetEvent(), rather than setting the NEM flag, should check it and bail out if it is not set (with a warning?). [The current behaviour is useful if you are sub-classing a control, and do not know which method a user of the control will want to use.]

Surely running both NEM and OEM code for the same event is a bug? In other words, a successful NEM call still causes the OEM logic to be run. If you happen to have an sub that matches, then you get two events being processed for a single event. See the code below for a better explanation:)

I've just tried to follow the logic in DoEvent and the if statement that checks to see if we need to run OEM seems suspect (well, in the context of a NEM/SetEvent)?

$|=1;
use strict;
use Win32::GUI;

my $W = new Win32::GUI::Window(
   -name => "TestWindow",
   -pos  => [  0,   0],
   -size => [210, 200],
   -text => "TestWindow",
);

$W->AddButton (
   -name    => "Start",
   -pos     => [65,5],
   -text    => "&Start",
   -tabstop => 1,
   #-onClick => sub {print 'clicked'},
);

#add the events to the button

$W->Start->SetEvent('Click',sub {print 'clicked'});

$W->Show;

Win32::GUI::Dialog();

sub Start_Click {
 print 'start click';
}



Reply via email to