Drag and drop with treeview

confused. :?

How does one go about making tree items draggable? I want to show a directory structure in a treeview and have it be possible to drag a directory to a different drop target.

I have a listview which is happily allowing me to drag items, and a second which is receiving them. I’m just stumped with the tree view.

AFAICT I need to assign a custom component for the tree item with createItemComponent. I should then be able to override the mousehandling stuff for the component, right? This doesn’t appear to be working though.

I’m sure this is easy, but I’m totally missing it. :roll:

That would be the way to do it at the moment, though I’m planning to tart-up the treeview to make drag and drop easier, like I did for the listbox.

It is possible though - the projects treeview in tracktion is draggable - so must be something you’re not doing right…

Well it appears in my case that the custom component isn’t receiving any mouse interaction.

I may be doing something silly with multiple inheritence[1] here though. I have my tree item inheriting from both TreeViewItem and Component. Is this why it is breaking? Also Is this actually legal, or will the tree attempt to dispose of the custom component after already disposing of the treeviewitem?

[1] bear with me, I’m more of an ‘interfaces’ man at the moment.

where’s that headbutt icon when you need it?

OK, so I was having a pascal moment, and forgot to put ‘const’ in the method overrides, so not surprisingly my mouse handlers were never called.

So, that all now works.