I should have mentioned that I am indeed using IronPython <a href="http://1.1.1.">1.1.1.</a><br><br>From what I can tell the objects are working very nicely with WinForms with the exception of PropertyGrid. <br><br>Were you using Propertygrid specifically?<br>
<br>C<br><br><div class="gmail_quote">On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco <<a href="mailto:rpigneri@lavastorm.com">rpigneri@lavastorm.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Dear Charles,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">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.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Try <a href="http://1.1.1." target="_blank">1.1.1.</a> 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.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">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).</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hope that helps,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Rocco</font></span></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>
[mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>Charles
Mason<br><b>Sent:</b> Wednesday, April 23, 2008 9:31 AM<br><b>To:</b>
<a href="mailto:users@lists.ironpython.com" target="_blank">users@lists.ironpython.com</a><br><b>Subject:</b> [IronPython]
System.Windows.Forms.PropertyGrid and Python objects<br></font><br></div><div><div></div><div class="Wj3C7c">
<div></div>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.<br><br>Things I've tried:<br><br>1) In Python,
PropertyGrid.SelectedObject = pythonobj <br>2) In Python, Deriving PropertyGrid
and overriding CreatePropertyTab<br>3) In C#, deriving a new class from
PropertyGrid and implementing<br><br>public void SetPythonObject(Object
obj)<br>{<br> this.SelectedObject = obj;<br>}<br><br><br>4) In C#,
Overriding CreatePropertyTab() (I get a warning about hiding a baseclass
implementation -- sounds like this isn't overrideable)<br>5) In C#, creating a
wrapper class:<br><br>class CustomHolder<br>{<br> private Object heldObj =
null;<br> public Object held {<br> get { return heldObj;
}<br> set { heldObj = value; }<br> }<br>
CustomHolder(Object obj) <br> {<br> this.held =
obj;<br> }<br>}<br><br>and in the derived PropertyGrid
class:<br><br>public void SetPythonObject(Object obj)<br>{<br>
this.SelectedObject = new CustomHolder(obj);<br>}<br><br>--<br><br>Only #5 so
far has done anything worthwhile: In the property grid as a single field I get
what looks like str(obj) output:<br><module.CLASSNAME instance at
0x................><br><br>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.<br><br>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)?<br><br>Chuck
</div></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br>