Dino, Thanks for your prompt reply. Unfortunately, your suggestion doesn't work either (it gives the same result when invoked from C#). Moreover, the first way (name = property(...)) worked fine when I just built my own C# class with its own virtual property.
Date: Thu, 26 Apr 2007 11:04:08 -0700 From: Dino Viehland <[EMAIL PROTECTED]> Subject: Re: [IronPython] can't override LayoutEngine property To: Discussion of IronPython <[email protected]> Message-ID: <[EMAIL PROTECTED] .microsoft.com> Content-Type: text/plain; charset="us-ascii" I believe currently you need to do: @property def get_MyLayoutEngine(self): return mle to get the get_ method to override this. A couple of people have ran into this and we don't seem to have a bug on it so I've opened bug #9902 (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=9902) to make this more intuitive. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Amsterdam Sent: Thursday, April 26, 2007 8:23 AM To: [email protected] Subject: [IronPython] can't override LayoutEngine property I'm trying to overrride the LayoutEngine property of Control so I can implement my own layout engine. I find that this doesn't work in IP. Accessing the LayoutEngine property in IP works fine, but it doesn't work from C#. //////////////////// C# code: public class MyCSharpClass { public static LayoutEngine getLayoutEngine(Panel p) { return p.LayoutEngine; } } //////////////////// Python code: class MyLayoutEngine(LayoutEngine): def Layout(self, parent, eventArgs): pass mle = MyLayoutEngine() class MyPanel(Panel): LayoutEngine = property(lambda self: mle) p = MyPanel() print "from Python:", p.LayoutEngine print "from C#:", MyCSharpClass.getLayoutEngine(p) //////////////////// output: from Python: <MyLayoutEngine object at 0x000000000000002B> from C#: System.Windows.Forms.Layout.DefaultLayout ============================================================================================= Email transmissions can not be guaranteed to be secure or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. In addition, the information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, disclosure of the parties to it, or any action taken or omitted to be taken in reliance on it, is strictly prohibited, and may be unlawful. If you are not the intended recipient please delete this email message. ============================================================================================== _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
