Drag&Drop of multiple files off the FileBrowserComponent doesn’t work because it always
deselects all rows first and then selects the one you’ve clicked onto, if you start dragging.
Any easy way to get arround this i.e. a flag?


Is it using a treeview or a listview? And is this the latest version? It sounds like something I fixed a long time ago…

Its a listview and i am running juce v1.52.74…

GIT update didn’t help here. Have you had a chance to look at, Jules? Thank you!

Is there an easy way to make drag and drop work with the FileBrowserComponent. I used to have it working with the FileTreeComponent, and with the latest juce build (from git), I have to ‘find’ the FileTreeComponent inside the FileBrowserComponent and then call setDragAndDropDescription on it. Is there a more elegant approach?

Ok, will fix this in my next check-in.

Was this fixed? I don't see it in the code. I currently hack the code to get the tree componet and set it's drag and drop ability. Of course with each new juce source I have to hack it again.

The thread is so old I have no idea, but assume something must have been fixed. If you explain what you're trying to do and what you're hacking, then maybe I can sort it out.

I need to drag and drop files from the FileBrowserComponent onto another component.


1. In the constructor code save the FileTreeComponent as a variable in FileBrowserComponent.

2. Add the function FileBrowserComponent::getFileTreeComponent() so users can use it. I also alter it's height.

3. Add the function FileBrowserComponent::setDragAndDropDescription (const String &dragAndDropName ) that just calls the same for the FileTreeComponent.

This will solve all requests.

My hack

This is my code in the constructor for my FileBrowserComponent override.

    //Retrieve the Juce FileTreeComponent
    //This is dangerous because it assumes that Juce adds this component first

    Component *p = getChildComponent (0);
    m_pTree = dynamic_cast<FileTreeComponent*> (p);
    m_pTree->setDragAndDropDescription ("File Tree");
    m_pTree->setItemHeight (16);



It already has a getDisplayComponent() method, so you can use that, e.g.

if (FileTreeComponent* tree = dynamic_cast<FileTreeComponent*> (browser.getDisplayComponent()))
    tree->setDragAndDropDescription  etc..

Yep that works. I see you had already implemented saving the variable. Sorry I missed it.

Thank you