Is it related to this? http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405 <http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405>
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Mason Sent: 23 April 2008 16:26 To: Discussion of IronPython Subject: Re: [IronPython] System.Windows.Forms.PropertyGrid and Python objects I should have mentioned that I am indeed using IronPython 1.1.1. <http://1.1.1.> >From what I can tell the objects are working very nicely with WinForms with >the exception of PropertyGrid. Were you using Propertygrid specifically? C On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Dear Charles, I ran into the same problem you are experiencing a few months ago while using Python 1.1. The problem is that the WinForms reflection is looking for static properties. IronPython 1.1 objects, being dynamic, lack the proper metadata to guide the WinForms classes to do the right thing. Try 1.1.1. <http://1.1.1.> That will allow WinForms to find a *whole* lot of things (including all your public methods). My guess is that it may be easier for you to turn off these extra elements rather than to create a separate C# assembly to hold static interfaces. It would be great to clean up these staticized properties in 1.1.2 to include only properties defined with the "property" function. That would really help anyone using static data binding in WinForms (or any other part of the BCL for that matter). Hope that helps, Rocco _____ From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] On Behalf Of Charles Mason Sent: Wednesday, April 23, 2008 9:31 AM To: users@lists.ironpython.com <mailto:users@lists.ironpython.com> Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects So I've been through hell last night tearing my hear out trying to figure out how to work PropertyGrid properly with a Python class object. Things I've tried: 1) In Python, PropertyGrid.SelectedObject = pythonobj 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab 3) In C#, deriving a new class from PropertyGrid and implementing public void SetPythonObject(Object obj) { this.SelectedObject = obj; } 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a baseclass implementation -- sounds like this isn't overrideable) 5) In C#, creating a wrapper class: class CustomHolder { private Object heldObj = null; public Object held { get { return heldObj; } set { heldObj = value; } } CustomHolder(Object obj) { this.held = obj; } } and in the derived PropertyGrid class: public void SetPythonObject(Object obj) { this.SelectedObject = new CustomHolder(obj); } -- Only #5 so far has done anything worthwhile: In the property grid as a single field I get what looks like str(obj) output: <module.CLASSNAME instance at 0x................> I've also considered using the TypeDescriptor() class/methods to create each property grid entry myself, but I don't see anything at all about where PropertyGrid gets its property fields from -- see #4. Is there any way to do this conveniently (I'd prefer not to write a C# custom dll, but am amiable to the requirement of doing so)? Chuck _______________________________________________ Users mailing list Users@lists.ironpython.com <mailto:Users@lists.ironpython.com> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com <http://lists.ironpython.com/listinfo.cgi/users-ironpython.com> ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com