Re: [win32gui] [perl-win32-gui-hackers] GUI_Events.cpp/DoEvent correct behaviour?

2005-10-20 Thread Jeremy White
I haven't tried this yet, but it seems wrong.  Can you raise a bug report 
and I'll dig further into this one.


http://sourceforge.net/tracker/?func=detailatid=116572aid=1333060group_id=16572

Ok - it seems this is only an issue when SetEvent is used (see example 
below, also on tracker).


What seems to happen is that the NEM event is called, and then it looks for 
an OEM event - if found that is ran too.


Cheers,

jez.
-



$|=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();





Re: [win32gui] [perl-win32-gui-hackers] GUI_Events.cpp/DoEvent correct behaviour?

2005-10-19 Thread Robert May

Jeremy White wrote:
I would have through that if a control was using NEM events, the OEM 
logic wouldn't be called for that control.


That certainly should be the case.  Unless you use the -eventmodel = 
'both' option on the control, only one of PERLWIN32GUI_OEM and 
PERLWIN32GUI_NEN flags should be set for the control in perlud-dwPlstyle.


For example, a button has a NEM click handler, I wouldn't expect DoEvent 
to look for OEM events such as MouseMove for the same button - but it 
does. If this is correct, it would mean that to save doing a perl_get_cv 
call (which is really inefficient) you would have to define all possible 
events for all controls?


Add this line:

  printf(EventName %s \n,EventName);

After:

   // OEM name event
   char EventName[MAX_EVENT_NAME];
   strcpy(EventName, main::);
   strcat(EventName, perlud-szWindowName);
   strcat(EventName, _);
   strcat(EventName, Name);

To see the amount of needless calls made...


I haven't tried this yet, but it seems wrong.  Can you raise a bug 
report and I'll dig further into this one.


Thanks,
Rob.
--
Robert May
Win32::GUI, a perl extension for native Win32 applications
http://perl-win32-gui.sourceforge.net/