Re: Drag-&-drop from the Windows Explorer?
John Henry <[email protected]> Sun, 15 Nov 2009 13:13:37 -0800 (PST)
| Newsgroups | gmane.comp.python.pythoncard |
|---|---|
| Message-ID | <[email protected]> |
Thanks to Alex Tweedly's post a few years back and pointed to:
http://wiki.wxpython.org/index.cgi/DragAndDropWithFolderMovingAndRearranging
I did it using Pythoncard style:
class FileDropTarget(wx.FileDropTarget):
def __init__(self, parent, obj):
wx.FileDropTarget.__init__(self)
self.parent = parent
self.obj = obj
def OnDropFiles(self, x, y, filenames):
try:
exec "self.parent.on_%s_DropFiles(x, y, filenames)"%self.obj.name
except:
pass
return
class MyClass(Minimal):
def on_initialize(self, event):
Minimal.on_initialize(self, event)
self.components.tree.SetDropTarget(FileDropTarget(self, self.components.tree))
def on_tree_DropFiles(self, x, y, filenames):
print filenames
This works. The only problem is that I don't know how to figure out who the dropped target is (in other words: which branch or item the dragged file was dropped onto) and so I can only assume that the selected item is the dropped target. Does anybody know how to figure out the dropped target?
--
John Henry
----- Original Message ----
> From: John Henry <[email protected]>
> To: [email protected]
> Sent: Mon, October 19, 2009 8:46:11 PM
> Subject: Drag-&-drop from the Windows Explorer?
>
> Hi list,
>
> Is it possible to accept a Drag-n-drop event from the IE running under Windows?
> In other words, if I drag a file from the drive folder and drop it onto a
> Pythoncard window, is there a way to raise an event and get, perheps the name of
> the file?
>
> If so, does anybody has any sample code?
>
> Thanks,
>
> --
> John Henry
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july