FileTreeView and Drag&Drop

gui

#1

There is this juce assert when I am dragging an Item inside my fileTreeComponent :
" to be able to do a drag-and-drop operation, the treeview needs to be inside a component which is also a DragAndDropContainer."
My class FileTreeView is placed inside the mainComponent, which is stated as a DragAndDropContainer.

Here is the code for my class FileTreeView:

class FileTreeView : public Component, DragAndDropContainer, private FileBrowserListener
{
public:

FileTreeView () :   thread ("audio file preview"),
					directoryToShow (nullptr, thread),
					fileTreeComp (directoryToShow)
{
	setBounds (0, 0, 200, 160);
	rootFolderForSoundLibrary =
	File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
	directoryToShow.setDirectory (rootFolderForSoundLibrary, true, true);
	directoryToShow.setFileFilter(nullptr);
	fileTreeComp.setDragAndDropDescription	("draggedFromRoot");
	thread.startThread (3);
	addAndMakeVisible(fileTreeComp);
	fileTreeComp.addListener (this);
	fileTreeComp.setBounds (getLocalBounds().reduced (4));
}
~FileTreeView()
{
}
void paint (Graphics& g) override
{
	g.fillAll (Colours::white);
}
void resized() override
{
}
void selectionChanged() override
{
	if (fileTreeComp.getSelectedFile().exists())
	{
		DBG(" FILE SELECTED = " << fileTreeComp.getSelectedFile().getFileName());
	}
}
void fileClicked (const File&, const MouseEvent&) override          {}
void fileDoubleClicked (const File&) override                       {}
void browserRootChanged (const File&) override			{}
std::function<void (const String& file)> fileChoosenCallback;

private:

TimeSliceThread 		thread;
DirectoryContentsList 	directoryToShow;
FileTreeComponent 		fileTreeComp;
File 					rootFolderForSoundLibrary;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileTreeView)

};


#2

You know, when DragAndropContainer is not declared public, it don’t work…