DnD between two window

Hi Guys,

I would like to know if it’s possible to have DnD between two different juce window ?

It seems that it would require native DnD source but it doesn t seem to be implemented. Am I missing something ?


Yes, you can do that with the normal drag-and-drop mechanism, no need to use the external stuff.

Hi Jules,

I’m trying to DnD an item from a TreeView to another Component
on another Window.

I’ve redefine getDragSourceDescription() on my custom TreeViewItem.
Now I can begin DnD and I can see the item dragged but as soon as I exit
the window the DnD image disappear and do not reappear when entering the other window.

The window containing the TreeView is a DocumentWindow.

Should I enable something to allow this ?


Did you set up the target as a DragAndDropContainer?

Should I still see the item image when the drag exit the window and/or
when entering the other window ?

Just to be sure I was clear, the source and target component are in two differents DocumentWindow.


Ah - did you spot the allowDraggingToOtherJuceWindows parameter in startDragging? That might just possibly be what you’re after!

Ahhhh maybe I ve missing something.
I don t call startDragging.
I ve only subclass getDragSourceDescription in my custom TreeViewItem.

looking at the code the default mouseDrag of TreeView do not indeed
set as true allowDraggingToOtherJuceWindows.

bug or feature your call :slight_smile:

If I modify juce code and set it to true it works fine.
Redefining mouseDrag in TreeView just to do that is tricky as it uses a lot of private member var/func.

Aha! Ok, I need to change that value to true. Will check that in shortly…

there’s exactly the same problem in ListBox (and other components I suppose)

I had to change

dragContainer->startDragging (dragDescription, &owner, dragImage);


dragContainer->startDragging (dragDescription, &owner, dragImage, true);

maybe the default parameter should true instead of false.

ok, I’ve changed those calls now…