I have a listbox which uses drag and drop. If I have multiple instances of my plugin, it is possible to drag from one instance to the other. There are two problems.
If instance A is covering instance B, and instance A is top most, juce will pick instance B as the drop destination depending on the order of windows. It should pick the instance that is on top, but it starts from the back of the list, apparently. See findDesktopComponentBelow() in juce_DragAndDropContainer.cpp
There is no way to turn off external drag and drop in the listbox, as it defaults to true. See line 129 of juce_Listbox.cpp.
There does not appear to be a way to add this functionality in a sub-class, so for now, I have just edited the Juce code with an optional flag to allow external dragging from list boxes.
That was the first thing I tried. Unfortunately, in that case, if they are overlapping, then it won’t allow you to drop on the area where the two instances intersect.
I wasn’t able to at first too. My plugin window has a component that covers the entire plugin window and is a draganddroptarget and also a draganddropcontainer. The listbox is inside this window.
I was using this code to see if its the same instance.
I think I have a use case related to point 2 in the original post. I have a ListBox in a CallOutBox floating window that I want to allow drag and drop only within that ListBox. As can be seen in the image below the drag and drop image is displayed under the CallOutBox. When I force allowDraggingToOtherWindows to false in juce_ListBox.cpp on now line 171 (version 7.0.4) I get the proper behavior. Would it be possible to add a set/get method “setAllowDraggingToOtherWindows(bool)” to ListBox?