[IronPython] can't override LayoutEngine property

Jonathan Amsterdam jba at ELLINGTON.com
Thu Apr 26 17:23:13 CEST 2007


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. 
==============================================================================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070426/e40f3f1a/attachment.html>


More information about the Ironpython-users mailing list