[IronPython] Problem: AllowDrop = True --> DragDrop registration failed

J. Merrill jvm_cop at spamcop.net
Fri Nov 18 15:46:59 CET 2005

A concession to reality could be that IP has to know (either figure out or be told) whether the app is intended to be a GUI (WinForms) app.  If it's GUI, then STAThread becomes the default.

I don't recall, off-hand, what the IP syntax is for specifying attributes -- particularly when (in C# or VB.Net) you use the STAThread attribute on the _class_ that represents your app, and IP's Main is not explicitly in a class.

At 10:26 PM 11/17/2005, Martin Maly wrote
>Actually, I wonder if this is related to the recent change in IronPython. When debugging IronPython we found out that Visual Studio often complains about the aplication thread being marked as STA and not pumping messages and our investigations showed that the way to make Visual Studio happy was to remove the STAThread attribute from IronPython's Main and go with the default.
>It creates an interesting class of problems, having the engine be marked one way, and the application running in it needing different apartment settings.
>Could you try putting the STAThread attribute back on the IronPython Main and let me know if you got things working that way? I am interested to know what implications it may have to have the main IronPython thread marked either way.
>thanks very much
>From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J. de Hooge
>Sent: Thursday, November 17, 2005 6:00 PM
>To: users at lists.ironpython.com
>Subject: [IronPython] Problem: AllowDrop = True --> DragDrop registration failed
>In the past months I've been coding quite extensively using previous versions of IronPython (upto 0.9.3) and the .NET 2.0 framework beta.
>One of the things I've been using a lot is drag&drop.
>Recently I've downloaded IP 0.9.5 and the "final" .NET 2.0 distribution.
>Setting the AllowDrop property of e.g. a Forms.ListView to True now results in an exception message: DragDrop registration failed.
>From the internet I've gathered that I should change the ApartmentState of my main thread to STA, using an attribute.
>But how can I do that from IP? And why is MTA the default, causing this problem?
>Or is there a different solution.
>Any help appreciated.
>Jacques de Hooge
><mailto:info at geatec.com>info at geatec.com

J. Merrill / Analytical Software Corp 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20051118/e92bfb8a/attachment.html>

More information about the Ironpython-users mailing list