Can not use Drag and Drop File with FileDragAndDropTarget

I used JUCE 5.2.0 I just created an area to drag and drop file there, I wrote a class inheritance from FileDragAndDropTarget. I run the app and dropped file there but function isInterestedInFileDrag wasn’t called? Does anyone help me why it was?

It’s hard to say without seeing any of your code but make sure that one of the Components in the parent hierarchy of your FileDragAndDropTarget derives from DragAndDropContainer.

Thank you for your reply.
Here is my code link
I used JUCE 5.2.0.
I dont know why the function isInterestedInFileDrag() wasn’t called when i drag a file.

Maybe it was a copy/paste error when you put it into the google doc, but I don’t think it compiled.
The paint method is missing the g as argument. The compiler would have complained, when you called g.fillAll (...) in paint.
Also it is not required, but you should add the keyword override after paint() and resized().

Can you double check, if it is actually running that code and not an outdated build without the FileDragAndDropTarget?

Sorry for my copy mistakes. Please help me view this code link
I’ve built and run this code.

Hi @daniel, is there any error with my code?
I can run it but the function isInterestedInFileDrag() wasn’t called. :frowning: !

I’ve just run your code and isInterestedInFileDrag() is being called when I drag a file over the Component. What platform is this on? Can you also try running your app with the latest tip of develop.

Thank @ed95, I’ve run the run code but isInterestedInFileDrag() wasn’t called. Did you run code with JUCE 5.2.0?

Yes. What platform are you on?

I run on Windows 10

OK I’ve just tried it on Windows 10 and it works fine, I’m really not sure what else to suggest here. Have you actually put a breakpoint in isInterestedInFileDrag() to see if it gets called when you hover a file over the window?

@ed95 Did you use Juce 5.2.0?


Thank you so much @ed95, I don’t know why but I’ll debug my program again. Thank so much for you replies :slight_smile:

I checked the Drag&Drop File demo within widgets.h: it works fine, if you use VS 2015, but doesn’t with VS2017. Any explanation for this?
Just run examples/demo under VS2015 -> file drag&drop works. Under 2017->doen’t work.
Work: accepts file for dropping.