There's a bug in beta 5 and beta 6 where we can sometimes fail to call the 
correct derived method.  You can work around the bug in many cases w/:

Class MyForm(Form):
        def __init__(self):
                self.OnKeyUp = self.OnKeyUp
        def OnKeyUp(self, e):
                ...

Unfortunately you can still get some erattic behavior w/ the workaround in 
place.

This will be fixed for our beta 7 release.  This happens only when deriving 
from a type that has a large number of virtual methods, and unfortunately 
System.Windows.Forms hits this pretty heavily.


Do you want to help develop Dynamic languages on CLR? 
(http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Jacobs
Sent: Friday, May 05, 2006 8:50 AM
To: Discussion of IronPython
Subject: [IronPython] Overriding derived methods

Hi,

I'm wondering how I override methods in a derived object, I'm not sure
whether this is the problem I'm experiencing or not but it looks that way.

Defining my own form object, with OnKeyUp method:

 >>> class MyForm(Form):
...   def OnKeyUp(self, e):
...     print '!!!'
...     Form.OnKeyUp(self, e)
...

The problem is that OnKeyUp in my Python object doesn't actually fire
when it should. I know I could do this by attaching an event but
according to the MSDN docs overriding the method in derived classes is
the preferred way to handle the event, it certainly seems cleaner.

Regards
--
Jonathan

_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to