Flabberghasted by Drag and Drop

REALLY enjoying JUCE so far. I’ll spare words on it this time around so I can get straight to the point.

Trying to get a drag and drop thing going on here and would like to be able to drag files onto my program and get their filenames as a result. However, even looking through the API documentation, I can’t begin to fathom how one would begin this. Do I have to inherit my window component from DropTarget? Do I have to implement itemDropped?

I haven’t tried anything yet, just read a bit, as this is a smaller part of my program and doesn’t need to be done – yet. But it does need to be done. Any help would be appreciated!

There’s a page in the demo app that does drag-and-drop, so that’s a good place to start.

There’s two kinds of drag-and-drop: internal or external. Internal is just for dropping things within your app, and is much more flexible. External lets you drop files into other apps.

Basically, a component that wants to receive things has to implement DragAndDropTarget. The top-level component has to implement DragAndDropContainer, because that’s the object that manages the whole drag operation.

If you just want to respond to files dropped check out Component.filesDropped.

Exactly what I should have seen :oops: Thanks!

Good point - I’ll add a note to the the drag-and-drop help comments mentioning Component::filesDropped()