Сергей Черниенко wrote:
[ snipped timer-related stuff ]
And does it mean that OEM
and NEM can not be mixed?

By default a window/control uses the Original/Old Event Model (OEM), where the sub that is called is the -name of the window/control followed by '_' followed by the event name itself. (So for a control with -name => 'ABC', the click event sub is ABC_Click. This sub must be located in package main (the default package).

As soon as any New Event Model (NEM) option is given to the constructor, Win32::GUI turns off all OEM subroutine calls. Using NEM allows us to use any sub name we want, from any package. We can event use anonymous subs.

If you really want to have both OEM and NEM callbacks existing at the same time, then you can pass -eventmodel => 'both' to the window/control's constructor (other allowed values are 'byname' to force OEM, and 'byref' to force NEM). If you have both event models enabled, then currently the NEM sub gets called first (but don't rely on this behaviour)

Personally I find it very confusing having both enabled, and I would consider it 'best practice' to use one or the other. The NEM is far more powerful (and essential if you want to put different bits of your UI code into different packages), but I can see how anyone coming from VB would find the OEM more understandable.

Hope this s useful.

Rob.

Reply via email to