Forum > RichMemo

Drag & drop into RichMemo

(1/1)

bungayst:
I want to be able to Drag text into a RichMemo. The drag and drop is easy, inserting the text at the location under the mouse cursor is the difficult bit. Anyone done this?

bungayst:
[SOLVED] Thanks for all the help.

CaretPos has nothing to do with it, which is misleading.

To drag and drop text from a TreeView node into a RichMemo;

procedure TForm1.RichMemo1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
  iNode  : String;

begin
  inode := TTreeview(Source).Selected.Text; //Treeview is the Source.

  RichMemo1.SelStart:=RichMemo1.CharAtPos(X,Y);
  RichMemo1.SelText:=iNode;

end;

Navigation

[0] Message Index

Go to full version