Hide the plugin on external drag and drop?


we have a plugin with a midi container component. We can drag this component into the DAW or anywhere to get the midi. And to make it easier for the user we want to hide our window during the drag.

void MidiDragAndDropHandle::mouseDown(const MouseEvent& e) {
	if (_tempMidiFile == File())

	const StringArray files = { _tempMidiFile.getFullPathName() };
	const bool canMoveFiles = false;
	DragAndDropContainer::performExternalDragDropOfFiles(files, canMoveFiles);

	if (auto* window = getTopLevelComponent()) {

void MidiDragAndDropHandle::mouseUp(const MouseEvent& e) {
	if (auto* window = getTopLevelComponent()) {

But it doesn’t work. And we trigger a jassert inside the juce code :

And after few tests, I noticed that the mouseUp is done right after the mouseDown when I call DragAndDropContainer::performExternalDragDropOfFiles.

Is it possible to add the missing code ? Or hiding the window during the drag and drop in some ways ?

Thank you a lot for your time !

No one has clue ?

The window where the plugin GUI is, is owned by the host and you shouldn’t really attempt doing anything special with that.

Yes, more or less. There is some plugins that have this behavior. And this a handy for the user. So it’s a pity to not be able to do it too ~_~

I’ve never seen a plugin like that, can you mention an example?

Captain chords ^^ When you drag and drop their little midi preview to the DAW. The window goes in background. Behind all others windows

@jules I would be gratefull if you would have a hint

AFAIK there’s nothing in the plugin APIs to even get hold of the containing window, let alone hide it.

If a plugin manages to do this then they must have written their own bodge for each OS to get hold of the native handle of the DAW’s window and force it to be hidden. They must have really wanted the feature because I think it’d be a total pain to write and maintain that code for all versions of all DAWs, and it’s not the kind of thing we’d want to commit to maintaining as part of juce.

Thank you for your answer ! Subject solved. :slight_smile: