Brian Millham wrote:
I'm working on a GUI interface to create skins for my skin module. I'd like to be able to set an event (using SetEvent('MouseDown', \&handle)),
>> and when I'd done with that event, reset the event to it's prior behavior.
>> Is there a way to do this?  I've looked on MSDN, and the closest that I
>> Can find is CloseHandle.  However, there does not appear to be a
>> way to get the handle of the event.

Events in Win32::GUI don't have 'handles', they have subroutines that get called (in the NEM they are perl code references)

Jeremy White wrote:
I may be misunderstanding - but couldn't you do something like:

my $original=\&Original;
$control->SetEvent('MouseDown', $original ));
...
#set new handler...
$control->SetEvent('MouseDown', \&handle));
...
#set back to original
$control->SetEvent('MouseDown', $original ));

Brian Millham replied:
> That's a possibility, but the original handler is set in the
> Skin.pm module. The Skin Editor uses the Skin.pm module, but
> needs to override handlers at certain times.

The GetEvent() method returns the current code reference for a NEM event (or undef if there isn't one), so something like this should do you:

my $old = $control->GetEvent('MouseDown');
...
$control->SetEvent('MouseDown', $old) if defined $old;

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


Reply via email to