I have a DropTarget class which is derived from wxFileDropTarget which
I can happily set as the drop target to controls or frames with
.SetDropTarget
What I'm wondering is if I can possibly set everything to be a drop target
across the whole application. To maybe have a frame or panel pass the
drop target down to any children in a nice way. I really dont want to have
to go through calling SetDropTarget across every control in my
application if I can help it. Is there any way of making an entire app and
all its controls FileDropTargets easily?
Not that I can think of. Which platform are you on? I had a vague recollection that it already worked this way but perhaps it is platform specific, or maybe it was something else I was thinking about.
···
On 2/29/12 9:34 AM, Paul wrote:
I have a DropTarget class which is derived from wxFileDropTarget which
I can happily set as the drop target to controls or frames with
.SetDropTarget
What I'm wondering is if I can possibly set everything to be a drop target
across the whole application. To maybe have a frame or panel pass the
drop target down to any children in a nice way. I really dont want to have
to go through calling SetDropTarget across every control in my
application if I can help it. Is there any way of making an entire app and
all its controls FileDropTargets easily?
Not that I can think of. Which platform are you on? I had a vague
recollection that it already worked this way but perhaps it is platform
specific, or maybe it was something else I was thinking about.
I'm on Mac, but will need something that will work on windows as well.
Not that I can think of. Which platform are you on? I had a vague
recollection that it already worked this way but perhaps it is platform
specific, or maybe it was something else I was thinking about.
I've written this which I think is as good as I'm going to get?
If I pass it a frame or a panel then it should take care of everything
def setDropTargets(parent,dt):
if hasattr(parent,"SetDropTarget"):
parent.SetDropTarget(dt)
if hasattr(parent,"Children"):
for child in parent.Children:
setDropTargets(child,dt)
Any idea on this? I though that function would work but when it runs
it crashes the app almost all the time (interestingly it doesn't seem
to when I stop it setting a drop target on wx._windows.ScrolledWindow
objects)
But it always crashes when I drag a file over (before I drop it)
In both cases I get a 'Python quit unexpectedly' and not even a
traceback
On Mar 1, 10:40 am, Paul <poal...@gmail.com> wrote:
Robin Dunn <robin <at> alldunn.com> writes:
> Not that I can think of. Which platform are you on? I had a vague
> recollection that it already worked this way but perhaps it is platform
> specific, or maybe it was something else I was thinking about.
I've written this which I think is as good as I'm going to get?
If I pass it a frame or a panel then it should take care of everything
def setDropTargets(parent,dt):
if hasattr(parent,"SetDropTarget"):
parent.SetDropTarget(dt)
if hasattr(parent,"Children"):
for child in parent.Children:
setDropTargets(child,dt)
On Mar 1, 10:40 am, Paul <poal...@gmail.com> wrote:
Robin Dunn <robin <at> alldunn.com> writes:
Not that I can think of. Which platform are you on? I had a vague
recollection that it already worked this way but perhaps it is platform
specific, or maybe it was something else I was thinking about.
I've written this which I think is as good as I'm going to get?
If I pass it a frame or a panel then it should take care of everything
def setDropTargets(parent,dt):
if hasattr(parent,"SetDropTarget"):
parent.SetDropTarget(dt)
if hasattr(parent,"Children"):
for child in parent.Children:
setDropTargets(child,dt)
Any idea on this? I though that function would work but when it runs
it crashes the app almost all the time (interestingly it doesn't seem
to when I stop it setting a drop target on wx._windows.ScrolledWindow
objects)
But it always crashes when I drag a file over (before I drop it)
In both cases I get a 'Python quit unexpectedly' and not even a
traceback
> Any idea on this? I though that function would work but when it runs
> it crashes the app almost all the time (interestingly it doesn't seem
> to when I stop it setting adroptargeton wx._windows.ScrolledWindow
> objects)
> But it always crashes when I drag a file over (before Idropit)
> In both cases I get a 'Python quit unexpectedly' and not even a
> traceback
You should create a new instance of thedroptargetfor each widget.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
Apologies for the top post, I clearly wasn't thinking
For each widget, do you mean each text, static bitmap, button, gif
etc.? Thats a lot of extra objects :S
or can I just make a new droptarget for each panel and re-use it for
its children. It seems to work great when I just use that function on
a single panel, it only seems to be a problem when I use it on the
frame, which has a bunch of panels and other controls which all
descend from it.
Any idea on this? I though that function would work but when it runs
it crashes the app almost all the time (interestingly it doesn't seem
to when I stop it setting adroptargeton wx._windows.ScrolledWindow
objects)
But it always crashes when I drag a file over (before Idropit)
In both cases I get a 'Python quit unexpectedly' and not even a
traceback
You should create a new instance of thedroptargetfor each widget.
For each widget, do you mean each text, static bitmap, button, gif
etc.? Thats a lot of extra objects :S
At least for those where you would like to be able to process the drop.
or can I just make a new droptarget for each panel and re-use it for
its children.
No, when you do SetDropTarget the window takes ownership of the drop target and will destroy it when the window is destroyed. If you assign the same one to more than one window then you'll get crashes like you've seen.