FileListComponent as DragAndDropContainer

Normally, having to dig in and modify the JUCE source code means I’ve overlooked something rather simple, but in this case I can’t see an easier way to get this working. I figured I better pose the question to wise sages of the JUCE library.

In order to get my custom FileListComponent to work as a DragAndDropContainer I had to modify the JUCE FileListComponent class. The FileListItemComponent that the FileListComponent uses does not handle mouse drags at all. I added the same mouseDrag implementation from the ListBoxRowComponent class into the FileListItemComponent class, and voila! everything works as expected. My custom FileListComponent subclass implements getDragSourceDescription, and drag and drop is working.

I suppose I could derive a subclass from FileListItemComponent and re-implement FileListComponent::refreshComponentForRow() in my FileListComponent subclass, but that seems rather pointless since I don’t really need to customize anything, just catch mouse drag events. The FileListItemComponent class already handles mouseDown and mouseDoubleClick events so it seems logical that it should handle dragging as well.

Is there any easier way to accomplish what I’m trying to do without modifying the JUCE source?

BTW this is with JUCE 1.51, so I don’t know if any of this was changed in the latest tip. We’re not in a position to transition this project to the latest tip yet, so I’m stuck at 1.51 for now.

Sorry - I can’t really help with 1.51, it’s probably significantly different to the current version.

Understood. I’ll revisit this when we move up to the latest version of the tip.