I am trying to get drag and drop to work. The demo program shows
how to use crtl-drag to do a copy operation, and that works for me.
I want to drag and drop without the control key, but I can’t get any
response (the target shows a (/) symbol, when dragged over).
Here’s my code running on wxPython 2.3.1, Python 2.1.1, Windows:
class NiMapDropTarget(wx.wxPyDropTarget):
def init(self, w):
wx.wxPyDropTarget.init(self)
self.w = w
self.data = wx.wxCustomDataObject(wx.wxCustomDataFormat(“NiObject”))
self.SetDataObject(self.data)
def OnEnter(self, x,y, d):
print 'OnEnter' # . . . (gets called, but disallows drop unless Ctrl is pressed)
return wx.wxDragMove # Also tried wx.wxDragCopy with same result
def OnData(self, x, y, d):
print 'OnData' # . . . (doesn't get not called unless Ctrl is pressed)
I’d like to show “copy” semantics (i.e. show the + symbol), but not require the
Ctrl key, since copy (and not move) is the only reasonable operation in this case.
However, I have not been able to get a drop to happen at all without Ctrl being
pressed.
- Ken