<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>If it is that conversion issue I actually think we might be able
to fix it. We do have a Converter.CanConvertFrom method and I’m not sure why
we’re not calling that instead of creating an instance and calling TryConvert.
It should be a relatively easy fix so I’ve raised the priority to high but I’d
also encourage voting on the bug.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b>On
Behalf Of </b>Charles Mason<br>
<b>Sent:</b> Wednesday, April 23, 2008 8:52 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] System.Windows.Forms.PropertyGrid and Python
obj ects<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>Yes.<br>
<br>
It's the only article that's worth reading that google turned up.<o:p></o:p></p>
<div>
<p class=MsoNormal>On Wed, Apr 23, 2008 at 11:30 AM, Masters, Christopher <<a
href="mailto:christopher.masters@credit-suisse.com">christopher.masters@credit-suisse.com</a>>
wrote:<o:p></o:p></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Is it related to this?</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'><a
href="http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405"
target="_blank">http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405</a></span><o:p></o:p></p>
<div>
<p class=MsoNormal> <o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center>
</div>
<div>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <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<o:p></o:p></span></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>Sent:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> 23 April 2008 16:26<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] System.Windows.Forms.PropertyGrid and Python
objects</span><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'>I should have mentioned that I
am indeed using IronPython <a href="http://1.1.1." target="_blank">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<o:p></o:p></p>
<div>
<p class=MsoNormal>On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco <<a
href="mailto:rpigneri@lavastorm.com" target="_blank">rpigneri@lavastorm.com</a>>
wrote:<o:p></o:p></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Dear Charles,</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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.</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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.</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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).</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Hope that helps,</span><o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Rocco</span><o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> <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</span><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal>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 <o:p></o:p></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">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><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
<pre>==============================================================================<o:p></o:p></pre><pre>Please access the attached hyperlink for an important electronic communications disclaimer: <o:p></o:p></pre><pre><o:p> </o:p></pre><pre><a
href="http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html"
target="_blank">http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html</a><o:p></o:p></pre><pre>==============================================================================<o:p></o:p></pre></div>
<p class=MsoNormal style='margin-bottom:12.0pt'><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><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>