# Flabberghasted by Drag and Drop

**URL:** <https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970>\
**Category:** General JUCE discussion\
**Created:** [August 3, 2006, 6:39am UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970 "2006-08-03T06:39:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sastraxi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sastraxi/32/438_2.png) [@Sastraxi](https://forum.juce.com/u/Sastraxi)\
**Post date:** [August 3, 2006, 6:39am UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/1 "2006-08-03T06:39:45Z")

</div>

Hey!  
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!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 3, 2006, 8:27am UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/2 "2006-08-03T08:27:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jtxx000](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jtxx000](https://forum.juce.com/u/jtxx000)\
**Post date:** [August 3, 2006, 2:06pm UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/3 "2006-08-03T14:06:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sastraxi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sastraxi/32/438_2.png) [@Sastraxi](https://forum.juce.com/u/Sastraxi)\
**Post date:** [August 3, 2006, 10:51pm UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/4 "2006-08-03T22:51:37Z")

</div>

Exactly what I should have seen :oops: Thanks!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 4, 2006, 9:52am UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/5 "2006-08-04T09:52:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 10:01am UTC](https://forum.juce.com/t/flabberghasted-by-drag-and-drop/970/6 "2017-05-12T10:01:13Z")

</div>


