[IronPython] can't override LayoutEngine property

Dino Viehland dinov at exchange.microsoft.com
Thu Apr 26 20:04:08 CEST 2007

I believe currently you need to do:

                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: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Amsterdam
Sent: Thursday, April 26, 2007 8:23 AM
To: users at lists.ironpython.com
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):

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070426/59eac1b6/attachment.html>

More information about the Ironpython-users mailing list