TEdit and TMemo? lazarus / 31-LCL ---------------------------------------------------------------------- kogs · 2015-08-27 08:26 Mac OS X 10.10.4 (14E46) - Mac mini (Mid 2011) TEdit - yes -> tedit0.png and tedit1.png TMemo - no -> tmemo0.png TEdit/TMemo -> TEdit - dmManual - yes, TMemo - dmAutomatic - yes (dmManual - yes) kogs ---------------------------------------------------------------------- skalogryz · 2015-08-27 12:59 hmm... dragMode should be used when "something" needs to be dragged- out of the control. Not within the control. Thus dragging text within the Memo itself, should work (at least with dmAutomatic) kogs: Is the problem with dragging text within TMemo (from one place to another)? ---------------------------------------------------------------------- kogs · 2015-08-27 13:12 TMemo - "qwert uiop" -> "t uiopqwer" -> no kogs ---------------------------------------------------------------------- skalogryz · 2015-08-27 13:15 ok. so it is about dragging text. ---------------------------------------------------------------------- kogs · 2015-08-28 08:09 TEdit - yes -> tedit0.png and tedit1.png TMemo - no -> tmemo0.png  kogs ---------------------------------------------------------------------- Michl · 2015-08-28 12:29 On Windows you can do (on Mac I don't know):Quoteprocedure TForm1.ControlDragDrop(Sender, Source: TObject; X, Y: Integer); var   RemoveOriginal: Boolean;   DragText: String;   NewText: String;   InsertPos: Integer;   OrigStart: Integer;   procedure InsertText;   begin     UTF8Insert(DragText, NewText, InsertPos);     if not RemoveOriginal then Exit;     if InsertPos < OrigStart then OrigStart := OrigStart + UTF8Length(DragText);     UTF8Delete(NewText, OrigStart, UTF8Length(DragText));   end; begin   if not Assigned(Source) then Exit;   if not ((Source is TMemo) or (Source is TEdit)) then Exit;   if not Assigned(Sender) then Exit;   if not ((Sender is TMemo) or (Sender is TEdit)) then Exit;   if Sender = Source then     RemoveOriginal := true   else     RemoveOriginal := false;   if Source is TEdit then begin     DragText := TEdit(Source).SelText;     OrigStart := TEdit(Source).SelStart + 1;   end else begin     DragText := TMemo(Source).SelText;     OrigStart := TMemo(Source).SelStart + 1;   end;   if Sender is TEdit then     InsertPos := MouseToPosition(TEdit(Sender), Point(X, Y)) + 1   else     InsertPos := MouseToPosition(TMemo(Sender), Point(X, Y)) + 1;   if RemoveOriginal and (Insertpos >= OrigStart) and (InsertPos <= OrigStart + Length(DragText)) then Exit;  //Same Position   if Sender is TEdit then begin     NewText := TEdit(Sender).Text;     InsertText;     TEdit(Sender).Text := NewText;   end else begin     NewText := TMemo(Sender).Text;     InsertText;     TMemo(Sender).Text := NewText;   end; end; function TForm1.MouseToPosition(Sender: TWinControl;   P: TPoint): Integer; begin   Result := 0;   if not Assigned(Sender) then Exit;   Result := LoWord(SendMessage(Sender.Handle, EM_CHARFROMPOS, 0, MakeLong(P.x, P.y))); end; Project added (you can select a text with the left mouse button, drag&drop with the right mouse button).