In a 32-bit VCL Application in Windows 10 in Delphi 11 Alexandria, I have a TRzShellTree
(from the Konopka Signature VCL Controls 7.0 available in GetIt):
object RzShellTree1: TRzShellTree
Left = 0
Top = 41
Width = 201
Height = 428
Align = alLeft
BaseFolder.Pidl = {
004301000014001F50E04FD020EA3A6910A2D808002B30309D19002F433A5C00
00000000000000000000000000000000000054003100000000003D5465581100
44454C50484900003E0009000400EFBE1423F90E42549B502E00000000930F00
000001000000000000000000000000000000DFED4800440045004C0050004800
4900000016005A0031000000000042546956100053757065724D525500004200
09000400EFBE2154F655425469562E000000210A000000004B00000000000000
0000000000000000C43CDA00530075007000650072004D005200550000001800
660031000000000042546F56100050524F4A45437E3100004E0009000400EFBE
4254695642546F562E00000043EB0A0000000B00000000000000000000000000
000008E22E00500052004F004A004500430054002000470052004F0055005000
5300000018000000}
Indent = 19
ReadOnly = True
SelectionPen.Color = clBtnShadow
TabOrder = 0
OnDragOver = RzShellTree1DragOver
end
...where I try to get information about a file dragged from Windows File Explorer over one of the nodes in the OnDragOver
event handler:
procedure TForm1.RzShellTree1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
CodeSite.Send('TForm1.RzShellTree1DragOver: Source.ClassName', Source.ClassName);
end;
Specifically, I need to get the FILE PATH of the file dragged over the node. If the file is a specific type (e.g. .DPROJ), I will set the var parameter Accept = True
and then process the file path further.
But unfortunately, the OnDragOver
event handler is NEVER CALLED when I drag a file over one of the nodes!
But I need to accept only specific file types and show that to the user. How can I do that?
As noted in the comments above, the OnDragDrop and OnDragOver events are specifically for the VCL internal drag and drop and are not involved in the OLE Drag-and-drop processing implemented by the TRzShellTree. Further complicating things is that there are no events surfaced in the TRzShellTree's OLE Drag-and-drop processing. The method that handles the drag over functionality is virtual, but I don't think that will lead to what you want.
Another option would be to turn off the OleDrag and OleDrop settings in the Options property and use the DropMaster components to deal with the Drag-and-Drop functionality. You have a lot more control over the drag operations with DropMaster.