Page 1 of 1

[Demo] Dragging URL from TreeView to RichViewEdit

Posted: Sat Sep 26, 2009 9:59 am
by Sergey Tkachenko
(3.94 KiB) Downloaded 518 times
TRichView supports the standard Windows (COM-based) drag&drop, but does not support VCL drag&drop.
With use of Drag&Drop Component Suite by Anders Melander ( ), you can easily implement drag&drop between VCL components and RichViewEdit.
New version of Drag&Drop Component Suite can be downloaded from ... nent-Suite

This demo shows how to drop:
- URLs listed in TTreeView
- bitmap contained in TImage
in TRichViewEdit.

[+] History of updates
2011-Oct-2: for compatibility with TRichView 13.4
2018-May-2: for compatibility with TRichView 17.3 and new version of Drag&Drop Component Suite
[+] Old versions ... - for TRichView from version 13.4 to 17.2

Posted: Sat May 19, 2012 4:07 pm
by Sergey Tkachenko
One more simple example using Drag&Drop Component Suite: dragging text from TRichViewEdit to TListBox ...

[+] History of updates
2018-May-2: compatibility with old versions of Delphi

Posted: Sat May 19, 2012 4:14 pm
by Sergey Tkachenko
Update: this information is obsolete. You can download a new version of D&D Component Suite from ... for-Delphi . It is compatible with new versions of Delphi.

The current version of Drag&Drop Component Suite is 5.2.
It is not compatible with Delphi XE2.

Changes required to install it in XE2:
1) Open DragDrop.pas, change all occurrences (2 times) of 'CF_MAX-1' to CF_LOCALE
2) Open DragDropContext.pas, change the declaration of methods of TDropContextMenu to

Code: Select all

    { IContextMenu }
    function QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst, idCmdLast,
      uFlags: UINT): HResult; stdcall;
    function InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult; stdcall;
    function GetCommandString(idCmd: UINT_PTR; uType: UINT; pwReserved: PUINT;
      pszName: LPSTR; cchMax: UINT): HResult; stdcall;

    { IContextMenu2 }
    function HandleMenuMsg(uMsg: UINT; WParam: WPARAM; LParam: LPARAM): HResult; stdcall;

    { IContextMenu3 }
    function HandleMenuMsg2(uMsg: UINT; WParam: WPARAM; LParam: LPARAM;
      var lpResult: LRESULT): HResult; stdcall;
The same changes must be made to implementation of these methods.
3) Open DragDropD2011 package, save it as DragDropDXE2, and install.

Posted: Wed Feb 20, 2013 6:43 am
by VBDavie
Also I noticed a couple of other changes needed to complete compile.
I have XE3 BTW.....

In the GetCommandString function there is this CASE statement:
case uFlags of //DLR was UType

Notice I changed from UTypes to UFlags ;) That is because the NAME OF THE PARAMTER into the procedure had changed from UType to UFlags.

function TDropContextMenu.HandleMenuMsg(uMsg: UINT; WParam: WPARAM; LParam: LPARAM): HResult;
lpResult: LRESULT; //DLR

Notice my REDEFINITION of the lpResult variable. It USED to be "Integer", It had to be CHANGED to LRESULT, because the variable is used in a procedure call and the procedure EXPECTS a variable of type LPRESULT and not INTEGER ;)

Anyways.... I got it to compile, so, YIPPIE!!!

Hope this helps someone out there!


Re: [Demo] Dragging URL from TreeView to RichViewEdit

Posted: Tue Aug 22, 2017 5:32 pm
by Sergey Tkachenko
For newer versions of Delphi, you can use ... for-Delphi