On 09/03/2015 at 10:45, xxxxxxxx wrote:
Hi,
Drag and drop methods are not currently documented in GeUserArea and GeDialog but they are fully functioning. They will be documented in the near future.
To receive drag and drop messages as expected it is important to return the appropriate values from Message() with SetDragDestination().
Here is the code I added to the Py-MemoryViewer example:
def Message(self, msg, result) :
if msg.GetId()==c4d.BFM_DRAGRECEIVE:
# Discard if lost drag or if it has been escaped
if msg.GetInt32(c4d.BFM_DRAG_LOST) or msg.GetInt32(c4d.BFM_DRAG_ESC) :
return self.SetDragDestination(c4d.MOUSE_FORBIDDEN)
# Check drop area and discard if not on the user area
if not self.CheckDropArea(msg, True, True) :
return self.SetDragDestination(c4d.MOUSE_FORBIDDEN)
print "Dragged"
# Get drag object type and data
draginfo = self.GetDragObject(msg)
# Check if drag is finished (=drop)
if msg.GetInt32(c4d.BFM_DRAG_FINISHED)==1:
print "Dropped"
return True
# Return current mouse cursor for valid drag operation
return self.SetDragDestination(c4d.MOUSE_MOVE)
# Call GeUserAre.Message() implementation so that it can handle all the other messages
return gui.GeUserArea.Message(self, msg, result)
Note GetDragObject() returns a dictionary with 2 object "type" and "object" (in the code I prefer to assign these individually).
MOUSE_POINT_HAND is returned for the current drag destination cursor but any other valid MOUSE value can be returned.
EDIT: Updated code.