FR: DragAndDropContainer allow dragging components onto Desktop

Hello dear JUCE Team, hello dear JUCE community!

It was a sunny day and I was developing as you would usually do on such a day.
All nice and cozy, I even had a cup of freshly brewed tea next to me, just for the drip you know. :sun_with_face:

But suddenly - out of nowhere, it struck me… struck me like your typical mountain goat while sitting on a park bench enjoying granny’s roastbeef steak from the day before, this ramming sensation on your buttocks because this goat would like to have a word with you. (or probably a bite off of granny’s roast beef steak)
But then you realise… “Oh no juce::DragAndDropContainer does not allow you to drag components out of the JUCE window as a target”, and you are telling yourself: “Let’s make a feature request!”. :+1:

Yes and that’s why I am here, I would like to make a proposal to allow juce components to be dragged out on the desktop. :slight_smile:

But wait, why would you want that Elanda?
A good question!
The thing is, I would love to have a way to drag components out and when dropped, they create their own windows.
Similar to what many applications already allow you to do, when you, for example, drag a tab out of the window and then they remain floating in their own windows on the Desktop. :smiley:

They way I did it until this request was to implement my own DragAndDropContainer based on JUCE’s, however, with all the updates and stuff, it’s a bit annoying trying to keep this up in future, so a framework supported feature would be nice. :sweat_smile:

Allow juce::DragAndDropContainer to drop components outside the window as its own target and let the user do whatever they want in that case.
Preferably, let them override a function like “droppedOnDesktop” or something like that, but maybe there are better ways.

Anyway, I thank the team and the community for their efforts,
I wish all of you a nice and happy day :slight_smile:


You can already do this. There’s an example in the JUCE demo (widgets demo?) IIRC.