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

J. de Hooge info at geatec.com
Fri Nov 18 11:26:55 CET 2005



First and foremost:


Adding [STAThread]  to Main solves the problem I had!



One other problem I am having is tooltips disappearing for good after having
closed a local menu by clicking on its "parent window",

But probably this has nothing to do with IronPython! (but with my own code
or .NET)



Some remarks about Visual Studio:


I use VS 2003 as a convenient editor and have installed IronPythonConsole as
an external tool, running it with a mouseclick.

Adding the [STAThread] initially did not seem to have any positive effect on
the AllowDrop problem.


That all changed when I ran the modified IronPythonConsole just once from
the commandline (with my Python app's main module as command parameter).

The bug had disappeared.

When I used VS after that to run IronPythonConsole, the bug did not show up

However, when I remove the [STAThread] attribute the bug reappears, both
from the command line and from VS.


I am telling you this because you had some problems with Visual Studio
"often complaining etc."

I haven't the remotest idea what's causing this inconsistent behaviour, but
it's clear to me that even only running stuff from VS can be tricky at




Jacques de Hooge

info at geatec.com


-----Oorspronkelijk bericht-----
Van: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] Namens Martin Maly
Verzonden: Friday, November 18, 2005 4:26 AM
Aan: Discussion of IronPython
Onderwerp: Re: [IronPython] Problem: AllowDrop = True --> DragDrop
registration failed


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


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



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


Or is there a different solution.

Any help appreciated.



Jacques de Hooge

info at geatec.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20051118/db9ba607/attachment.html>

More information about the Ironpython-users mailing list