Hi Vinn ! Thanks for your reply.
I think we both agree that you have only one sourceComponent here :
void DragAndDropContainer::startDragging (const var & sourceDescription,
Component * sourceComponent,
const Image & dragImage = Image::null,
bool allowDraggingToOtherJuceWindows = false,
const Point< int > * imageOffsetFromMouse = nullptr
What I’m trying to do is to have multiple source components, and multiple dragAndDropTargets.
Just imagine that in a sequencer, you’re dragging several clips on several tracks for example.
I don’t see how this can be done using only juce drag and drop implementation. Maybe you do ?
Don’t want to bother you with the details but for one clip, what I do is that I call startDragging, and I update my model in the DragAndDropTarget methods, which in turn updates the views. This is working perfectly. On the other hand, if I have several clips, this approach doesn’t work. Unless it’s safe to call startDragging for each component (clip) in sequence ? I’m not sure it works …
There’s always the workaround of not using a drag image and displaying whatever you want in the DragAndDropTarget (itemDragEnter/itemDragMove/itemDragExit) .
Nope I’m deriving my content component from a custom MultiDragAndDropContainer.
Code like : (from DragAndDropContainer)
[code]MouseInputSource* draggingSource = Desktop::getInstance().getDraggingMouseSource (0);
if (draggingSource == nullptr || ! draggingSource->isDragging())
jassertfalse; // You must call startDragging() from within a mouseDown or mouseDrag callback!
const Point<int> lastMouseDown (Desktop::getLastMouseDownPosition());
Is independant of how many components you want to drag at once. Sometimes -well most of the time- I’m not cloning the code but trying to understand it and doing the same thing a bit differently but the global algorithm stays the same.
Do you mean DragAndDropTarget ? In this case, yes.