# File Tree Component as Drag and Drop Source

**URL:** <https://forum.juce.com/t/file-tree-component-as-drag-and-drop-source/5312>\
**Category:** General JUCE discussion\
**Created:** [May 25, 2010, 4:36pm UTC](https://forum.juce.com/t/file-tree-component-as-drag-and-drop-source/5312 "2010-05-25T16:36:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [May 25, 2010, 4:36pm UTC](https://forum.juce.com/t/file-tree-component-as-drag-and-drop-source/5312/1 "2010-05-25T16:36:04Z")

</div>

I use a FileTreeComponent as a Drag and Drop Source.

I set up the DragAndDropDescription : fileTree-\>setDragAndDropDescription(“DnDFile”)

So my DragAndDropTarget gets always the same Description “DnDFile” and the Component\* ItemComponent.

Whats the best way to get the filename behind the ItemComponent?

There should be a File FileTreeComponent::getItemFile(Component\* ItemComponent) or the name of the File should be in the DragAndDropDescription

any idea?

---

<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 25, 2010, 5:21pm UTC](https://forum.juce.com/t/file-tree-component-as-drag-and-drop-source/5312/2 "2010-05-25T17:21:34Z")

</div>

From the component, you can find the treeview, and then you can ask the treeview for all its selected items, as those are what is being dragged.

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [October 25, 2010, 12:01pm UTC](https://forum.juce.com/t/file-tree-component-as-drag-and-drop-source/5312/3 "2010-10-25T12:01:09Z")

</div>

thanks, i found another point:  
When selecting muliple Files, and you drag the files, only the one (which where the mouse is) will be painted as drag-image.
