DataViewCtrl drag and drop working on OSX but not on windows

Hi,

I am experimenting with drag&drop within a DataViewCtrl. The attached sample works very well on OS X with both wxpython classic 3.0.2 and phoenix 3.0.3 (snapshot build) and python 2.7. It does not work on windows (7) though. Whenever you start to drag an item the ‘forbidden’ icon is shown. I have not been able to test it on linux. If anybody could do it it would be nice to hear the results. Any ideas on how to get it to work on windows?

Btw: I would consider the 3.0.2 implementation to be buggy/incomplete since evt.GetModel() returns a DataViewModel rather than a PyDataViewModel. Apparently this has been fixed in 3.0.3.

Regards, Christian

sample.py (4.56 KB)

Answering to myself. I got it working, see the attached sample. The necessary changes were:

  • attach a DataObject to the event in the dv.EVT_DATAVIEW_ITEM_BEGIN_DRAG handler
  • explicitly enable drag source and drop target for the DataViewCtrl with DataFormat wx.DF_UNICODETEXT (wx.DF_TEXT does not work) in case the DataObject attached to the event is a wx.TextDataObject

I am unable though to read back the TextDataObject in the drop handler but for the moment I do no care.

Christian

sample.py (4.89 KB)

···

El domingo, 1 de enero de 2017, 21:56:28 (UTC-3), Christian K escribió:

Hi,

I am experimenting with drag&drop within a DataViewCtrl. The attached sample works very well on OS X with both wxpython classic 3.0.2 and phoenix 3.0.3 (snapshot build) and python 2.7. It does not work on windows (7) though. Whenever you start to drag an item the ‘forbidden’ icon is shown. I have not been able to test it on linux. If anybody could do it it would be nice to hear the results. Any ideas on how to get it to work on windows?

Btw: I would consider the 3.0.2 implementation to be buggy/incomplete since evt.GetModel() returns a DataViewModel rather than a PyDataViewModel. Apparently this has been fixed in 3.0.3.

Regards, Christian

Just for the records: fixed one (last) bug and now it works on windows (3.0.2.0 and phoenix), OSX (3.0.2.0 and phoenix) and linux (python-wxGTK3-3.0.2.0). See attached code.

sample.py (4.91 KB)

···

El domingo, 1 de enero de 2017, 21:56:28 (UTC-3), Christian K escribió:

Hi,

I am experimenting with drag&drop within a DataViewCtrl. The attached sample works very well on OS X with both wxpython classic 3.0.2 and phoenix 3.0.3 (snapshot build) and python 2.7. It does not work on windows (7) though. Whenever you start to drag an item the ‘forbidden’ icon is shown. I have not been able to test it on linux. If anybody could do it it would be nice to hear the results. Any ideas on how to get it to work on windows?

Btw: I would consider the 3.0.2 implementation to be buggy/incomplete since evt.GetModel() returns a DataViewModel rather than a PyDataViewModel. Apparently this has been fixed in 3.0.3.

Regards, Christian