Request: DragAndDropTarget::dragAndDropCancelled

Hi Julian!

I need a virtual method to tell a target that the current DragAndDrop operation is cancelled.

The itemDragExit method is not sufficient because an item can leave the target (itemDragExit) and then can enter the same target again and so on. I cannot rely on itemDragExit event because it can happen several times before completion. I need the only one event on cancelation. I need a way to register DragAndDropTarget instances that want to receive cancellation event from DragAndDropContainer class instance.

The problem is I hide a component that is currently being dragged and rearrange neighbour components to make a room for the item while the ‘drag and drop’ operation is active. So, if the operation is cancelled (an item is dropped outside the target and none component is interested in it) then the hidden item stays invisible and that’s not what I need. If I’d know that the operation is cancelled I might roll everything back to its original state.

What do you say?

…rather…record all target components which are interested in the particular dragging source along the mouse way until the task completion. On cancelation, iterate over the recorded targets and call ‘dragAndDropCancelled’ method to inform the targets the drag-and-drop task was not accomplished…

Good request, though I managed to do the same thing in the toolbar component without needing a callback. Each item will get a drag-exit message, so it’s always possible to keep track of which ones are currently being dragged-over.

…yes, Julian. I’ve looked into the toolbar source code. But you rearrange items on enter and arrage them back on exit. I do not need to arrange them back on drag exit, just on cancelation. It’s just because I sort them along the way and continue sorting on entering the same target again within the same darg-and-drop operation. That’s the point. Will you implement this, Julian? Pleeeeeez :slight_smile:

P.S. BTW I’m on the way of creating a nice calendar component for JUCE now. So I’ll submit it for your revision soon. :wink:

ok, I’ll put it on the to-do list…