DnD between two window


#1

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 ?

Thanks,


#2

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


#3

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 ?

Thanks,


#4

Did you set up the target as a DragAndDropContainer?


#5

Yep.
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.

Thanks,


#6

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


#7

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.


#8

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


#9

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

I had to change

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

to

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

maybe the default parameter should true instead of false.


#10

ok, I’ve changed those calls now…


#11