Drag and Drop, From ListCtrl to Desktop?

All -

The scenario in which I'm having trouble:

I have a ListCtrl in the Report style displaying a list of files. I would like to be able to drag one of the items from the list onto my xp desktop, explorer, etc and have the drag and drop operation copy the a file (who's path is derived from the list item text) from the previous location to the destination. No need to modify the list or do anything fancy, just want to copy the file.

All example code I've come across deals primarily with text data. Is it so different to handle a file object? Is there any need to handle an actual file object?

I have attempted to extend wx.PyDataObjectSimple just as shown in the pyDocs (http://www.wxpython.org/docs/api/wx.PyDataObjectSimple-class.html) but all variations of my code crashed any destination app I attempted to drop into.

Does anyone have a good, simple example of this? Or something similar enough so that I may adapt it to my needs?

Any help would be much appreciated!

- Jason

Jason Johnson wrote:

All -

The scenario in which I'm having trouble:

I have a ListCtrl in the Report style displaying a list of files. I would like to be able to drag one of the items from the list onto my xp desktop, explorer, etc and have the drag and drop operation copy the a file (who's path is derived from the list item text) from the previous location to the destination. No need to modify the list or do anything fancy, just want to copy the file.

All example code I've come across deals primarily with text data. Is it so different to handle a file object? Is there any need to handle an actual file object?

I have attempted to extend wx.PyDataObjectSimple just as shown in the pyDocs (wxPython API Documentation — wxPython Phoenix 4.2.2 documentation) but all variations of my code crashed any destination app I attempted to drop into.

Use a wx.FileDataObject instead.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!