Hi all,
hope that this is the right forum for my request:
We are using treemixin.py. Expecially DragAndDrop. With the existing method
"IsValidDropTarget" it's very easy to filter out all the unwanted targets. It
would be nice also to have a similar method to filter out all unwanted
drag-items.
That could be done very easy by implementing such a method and calling it in
OnBeginDrag:
def OnBeginDrag(self, event):
# We allow only one item to be dragged at a time, to keep it simple
#-->start changes for using a method IsValidDragItem
# self._dragItem = event.GetItem()
# if self._dragItem and self._dragItem != self.GetRootItem():
dragItem = event.GetItem()
if self.IsValidDragItem(dragItem):
self._dragItem = dragItem
#-->stop changes for using a method IsValidDragItem
self.StartDragging()
event.Allow()
else:
event.Veto()
def IsValidDragItem(self, dragItem):
if dragItem and dragItem != self.GetRootItem():
return True
else:
return False
Overloading IsValidDragItem makes it easy do customize the behaviour.
Any chance to get such a method in one of the next releases?
Thanks
Helmut Schierer