[IronPython] Issues with methods as event handlers?

Giles Thomas giles.thomas at resolversystems.com
Wed Feb 1 11:10:09 PST 2006


Hi all,

When we use bound methods as Windows Forms event handlers, we can't 
detach them.  Functions work OK.

To see the problem, run up the attached button_method.py using 
IronPythonConsole; if you click on the "Trigger" button, you'll see a 
log message in the console saying that the trigger method has been 
called.  Click on the "Remove" button to remove the event handler, and 
then click on the "Trigger" button again - you'll still get the log 
message.  So the event handler was not detached correctly.

By contrast, if you do the same thing using button_function.py, you will 
see that once you have clicked on "Remove", the "Trigger" button's 
handler will be correctly detached, so further clicks on that button 
will not generate log messages.

We've tested against beta 2, beta 1, and 0.9.5 (which latter doesn't 
display the button labels but otherwise behaves as described above).

Hope this helps someone :-)


Cheers,

Giles
-- 
Giles Thomas
Resolver Systems
giles.thomas at resolversystems.com
We're hiring! http://www.resolversystems.com/jobs/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: button_method.py
Url: /pipermail/users-ironpython.com/attachments/20060201/ed836211/button_method.ksh
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: button_function.py
Url: /pipermail/users-ironpython.com/attachments/20060201/ed836211/button_function.ksh


More information about the users mailing list