Here is my problem : I want to add a Drag and Drop feature in my program to allow the drag and drop of MIDI files into Tracktion… I know it’s possible to do this because I have tried to drag and drop a MID between Tracktion and the Windows’ Explorer window…
How can I do this with Juce ? The function I must use is this one but I don’t know how to configure it…
no, that’s only for internal juce-based dragging, it can’t drag things outside into other apps.
Check out PlatformUtilities::canDropFilesAtMousePosition() and dropFilesAtMousePosition(). You can use these in your mouseDrag() and mouseUp() methods, and set the cursor appropriately.
if (dragCours)
{
sa.add(fileHard->getFullPathName());
if (PlatformUtilities::canDropFilesAtMousePosition())
PlatformUtilities::dropFilesAtMousePosition(sa);
}
dragCours = false;
}[/code]
As you have understood, that doesn’t work, and if I try for example to drag in the Dev C++ Explorer, it shows me one window for each character in the path, for “C:\Win.mid” it says me :
“Can’t find C”
“Can’t find :”
"Can’t find "
“Can’t find W” etc. etc. etc.
But if i drag and drop from the Windows’ Explorer windows, that works. So maybe a bug in Juce ?
oh, maybe win98 doesn’t handle the wide char stuff properly. Try setting the value to false and see if that works - I’ll have a proper look at it for the next release…
[quote=“jtxx000”]Another question that’s slightly off topic:
Is there any way to have drag and drop between two running instances of the same app?[/quote]
well you can use the normal drag + drop, like you would between juce and non-juce apps, but not the clever internal drag-and-drop stuff because they don’t live in the same memory-space.
i tried using dropFilesAtMousePosition() but it doesn’t seem to be working for some reason. When i try to drag between two instances of my app canDropoFilesAtMousePosition() returns true but dropFilesAtMousePosition() doesn’t call the filesDropped() method on the other app. if you try to drop a file from my app to windows explorer canDropoFilesAtMousePosition() returns false.