If 2.6 doesn't work unmodified there's also adding the 2 needed lines
to 2.0's pyc:
mainMethod = tb.DefineMethod('Main', MethodAttributes.Public |
MethodAttributes.Static, int, ())
+ if targetKind == System.Reflection.Emit.PEFileKinds.WindowApplication:
+
mainMethod.SetCustomAttribute(clr.GetClrType(System.STAThreadAttribute).GetConstructor(()),
System.Array[System.Byte](()))
gen = mainMethod.GetILGenerator()
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael Foord
Sent: Wednesday, August 19, 2009 3:45 PM
To: [email protected]; Discussion of IronPython
Subject: Re: [IronPython] FolderBrowserDialog does not show folders
David Escobar wrote:
> How would I tag Main with the [STAThread] attribute in IronPython? I
> thought IP didn't yet have the ability to use attributes...
Unfortunately that is something that needs to be done in the Pyc
compiler. Did you try Curt's suggestion of using the 2.6 Pyc.py?
Michael
>
> On Wed, Aug 19, 2009 at 3:11 PM, Curt Hagenlocher
> <[email protected] <mailto:[email protected]>> wrote:
>
> ...which has been fixed for IronPython 2.6. You might be able to
> use the 2.6 pyc.py script against 2.0.
>
>
> On Wed, Aug 19, 2009 at 3:09 PM, Curt Hagenlocher
> <[email protected] <mailto:[email protected]>> wrote:
>
> It's a COM issue. The emitted Main needs to be tagged with the
> [STAThread] attribute.
>
> On Wed, Aug 19, 2009 at 11:41 AM, David Escobar
> <[email protected] <mailto:[email protected]>> wrote:
>
> Yes, I am. The full command line I'm using is:
> *"C:\Program Files\IronPython 2.0.2\ipy.exe" pyc.py
> /out:FolderBrowserDialogTest
> /main:FolderBrowserDialogTest.py /target:winexe
> FolderBrowserDialogTest.py*.
>
> The dialog window does come up with every control except
> the tree view of folders.
>
>
>
> On Wed, Aug 19, 2009 at 11:27 AM, Dino Viehland
> <[email protected] <mailto:[email protected]>> wrote:
>
> Are you compiling w/ the "/target:winexe" option?
> You'll need to provide that for doing WinForms
> development.
>
>
>
> *From:* [email protected]
> <mailto:[email protected]>
> [mailto:[email protected]
> <mailto:[email protected]>] *On
> Behalf Of *David Escobar
> *Sent:* Wednesday, August 19, 2009 11:03 AM
> *To:* Discussion of IronPython
> *Subject:* [IronPython] FolderBrowserDialog does not
> show folders
>
>
>
> I've noticed an issue with the FolderBrowserDialog
> window from IronPython. When I display it with the
> ShowDialog method in a compiled script (through
> pyc.py), it does not show the TreeView of folders. It
> will display the Description title and the buttons,
> however. If I run the script straight through the
> interpreter, it will display the folders just fine.
> For reference, I also tried the OpenFileDialog and
> SaveFileDialog, and those show up correctly in both
> methods. Is this a bug, or am I doing something wrong?
>
> Sample code below:
>
> *import clr
> clr.AddReference("System.Windows.Forms")
> from System import *
> from System.Windows.Forms import *
>
> dlg = FolderBrowserDialog( )
> dlg.Description = "Testing..."
> dlg.ShowDialog( )*
>
>
>
> _______________________________________________
> Users mailing list
> [email protected] <mailto:[email protected]>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com