I have a richedit(richedit1) and a listbox(listbox1),
I want to drag the richedit1.text without affecting its text selection. here some code:
procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;State: TDragState; var Accept: Boolean);
begin
Accept := (Source is TRichEdit) ;
end;
procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is TRichEdit then ListBox1.Items.Add(RichEdit1.SelText);
end;
When i set RichEdit1.DragMode to dmAutomatic, draging works fine, but i can not select text in richedit by mouse.
I know one solution is Like this:
procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Sender is TCustomRichEdit) and (ssCtrl in Shift) then
TCustomRichEdit(Sender).BeginDrag(False);
end;
But i don't want to drag by holding ctrl key;
Do you have any better idea?