[Demo] Dragging URL from TreeView to RichViewEdit

Demos, code samples. Only questions related to the existing topics are allowed here.
Post Reply
Sergey Tkachenko
Site Admin
Posts: 13026
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[Demo] Dragging URL from TreeView to RichViewEdit

Post by Sergey Tkachenko » Sat Sep 26, 2009 9:59 am

TRichView supports the standard Windows (COM-based) drag&drop, but does not support VCL drag&drop.
However, with use of Drag&Drop Component Suite by Anders Melander ( http://www.melander.dk/ ), you can easily implement drag&drop between VCL components and RichViewEdit.

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

http://www.trichview.com/support/files/ ... omtree.zip

Updates:
2011-Oct-2: for compatibility with TRichView 13.4

Sergey Tkachenko
Site Admin
Posts: 13026
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Sat May 19, 2012 4:07 pm

One more simple example using Drag&Drop Component Suite: dragging text from TRichViewEdit to TListBox
http://www.trichview.com/support/files/ ... istbox.zip

Sergey Tkachenko
Site Admin
Posts: 13026
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Sat May 19, 2012 4:14 pm

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.

VBDavie
Posts: 1
Joined: Wed Feb 20, 2013 6:36 am

Post by VBDavie » Wed Feb 20, 2013 6:43 am

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.

ALSO:
function TDropContextMenu.HandleMenuMsg(uMsg: UINT; WParam: WPARAM; LParam: LPARAM): HResult;
var
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!

Davie

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest