Possible to drag string information between two Juce windows


Is it possible to use DragAndDropContainer::performExternalDragDropOfText( ) to pass information between two separate applications created by Juce? I was considering using DragAndDropContainer::performExternalDragDropOfFiles( ) to do so, but this enables the user to drop files on the desktop, which I’d like to avoid if possible. Also, if this is feasible, is this functionality currently supported on Mac OS X as well?

Thanks in advance,


Yes, I’m sure that’d work. It’s implemented on OSX AFAIK.


I appreciate your quick reply!

Could you clarify a little more? DragAndDropTarget::itemDropped(const String& sourceDescription, Component* sourceComponent, int x, int y) is the only method I’ve found that seems to receive a dragged object from another application. However, if I’m passing a String with DragAndDropContainer::performExternalDragDropOfText( ), will DragAndDropTarget::itemDropped() callback with the string information contained in its sourceComponent parameter? Or is there another approach that I’m not aware of?


What version of Juce are you using?


I’m currently using 1.52.


Ah, sorry, I was thinking about dragging a text snippet, but not receiving one - in fact I don’t think there’s anything to do that. For files we have FileDragAndDropTarget, but nothing for text at the moment…


I see - I wonder if you have any workarounds for what I’m trying to accomplish then? Basically I would like to drag an object from one window to another, where the object would contain some kind of formatted information which the other window would understand how to read. As you mentioned above, this is possible with a file, but I don’t want the user to have the option to just drop a proprietary-formatted file anywhere on their desktop. If possible, I’d to be able to drag between one section of window A, to another section of window B. Any help is greatly appreciated!


Tricky one. If I was trying to do that myself, I’d probably first implement the ability to receive drag-and-dropped text, and then do what you were originally planning…


Got it. Thanks for your help!