I have a DirectoryTreeView and an FMXDropTarget component sitting on my form. I want to be able to drag files out of the DirectoryTreeView and drop them on the Drop Target, preferably with multiple selections. I know how to handle the files when they are dropped onto the Drop Target, but I'm having problems selecting and starting the drag operation in the TMSFMXDirectoryTreeView component.
I can set the Interaction.MultiSelect, and Interaction.ExtendedSelectable properties OK when DragMode is the default value, but setting the DirectoryTreeview.DragMode to DragMode.dmAutomatic stops me from selecting any nodes at all, and shows the entire control window when I drag. There doesn't appear to be any OnStartDrag event handler like there is with vcl either.
I need assistance please, I'm stuck!!
Hi,
Thanks for the fast reply Pieter.
So these drag mode and events aren't useable? If they act on the whole DirectoryTreeCiew object, then could the whole TreeView be dropped on the drop target, and then it might be possible to extract the selected nodes text from the object when dropped? Then all I'd need is some way to change the drag image, and some way to make it possible to do the multi selection when DragMode is set to dmAutomatic.
At the moment I'm trying to drop a DirectoryTreeView onto the drop target, but the droptarget won't let me, and the on line help documentation for FMX.ExtControls.TDropTarget tells me to set Accept := true in the DragOver event, to accept any object, but Delphi won't compile that instruction. So I'm stuffed at both ends :-{
Drag & drop is implemented at FireMonkey control level. You will need to manually construct a TDragObject record and then you can use the IFMXDragDropservice to begin a drag / drop operation. Below is some sample code to get you started.