Help: Drop text to TMemo from another Application lazarus / 66-Unix ---------------------------------------------------------------------- OH1KH · 2018-03-28 15:28 HI ! I need help for simple thing that I can not make work, and do not found any (right words?) solution with search. I have Tmemo with some text. Say  it has "Hello". I paint word "world" from another App and drag and drop it over Tmemo. Tmemo will then have text "Helloworld". But I want that dropping erases "hello" and leaves just "world". I have tried several ways: OnDrop (Tmemo.Clear) OnMouseOver(select all, but if drag is on no selection is made, otherwise yes) ONMouseUP .... and so on. Is there even any way to do "ReplaceOnDrop" with linux/gtk2 ? ---------------------------------------------------------------------- OH1KH · 2018-04-01 10:37 Hi! Seems that that nobody does know solution for this! Over 200 times read, with no suggestions at all. One way to go around this is to paint text in other program, NOT drag it, place cursor over TMemo and press mouse wheel button. In that way at least my Fedora26/LXDE erases the old text and drops the painted text in TMemo. But that is a work around, not solution. ---------------------------------------------------------------------- wp · 2018-04-01 11:01 Can't you call Memo.SelectAll in the OnDragDrop code as first statement? ---------------------------------------------------------------------- balazsszekely · 2018-04-01 11:59 QuoteSeems that that nobody does know solution for this! Over 200 times read, with no suggestions at all. Perhaps people are busy with other things... QuoteBut that is a work around, not solutionYou have an OnDropFiles event(Form1) just clear the memo there and you're good to go: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of String);begin  Memo1.Clear;end; ---------------------------------------------------------------------- Soner · 2018-04-01 12:17 You can't do this with lazarus onboard functions/components. Look at the gtk2 documentation. On  Windows you can use  drag&drop components from A.Melander look here https://forum.lazarus.freepascal.org/index.php?topic=38761.0. @people I think he means dragging text from another text application(i.e. gedit) and dropping on his application to the Tmemo. ---------------------------------------------------------------------- balazsszekely · 2018-04-01 12:23 Quote@people I think he means dragging text from another text application(i.e. gedit) and dropping on his application to the Tmemo.That's exactly what I did. Just select some text in gedit then drag-drop it to a memo. The lazarus application thinks you're dropping files, this is why my solution works(see above). ---------------------------------------------------------------------- OH1KH · 2018-04-01 13:32 Hi ! TForm1.FormDropFiles does not work. Dropping does not clear previous content. As well as  Memo.SelectAll does not do it. So it seems that mouse wheel button is the only way. (linux/gtk2) ---------------------------------------------------------------------- balazsszekely · 2018-04-01 13:39 It works for me on Linux mint. I can make a video if you like. What is your system? ---------------------------------------------------------------------- OH1KH · 2018-04-02 07:25 Fedora26/LXDE ---------------------------------------------------------------------- balazsszekely · 2018-04-02 07:36 Unfortunately I don't have Fedora so I cannot test. I have one more question though. Does Form1 FormDropFiles triggered when you drag-drop something over the memo? ---------------------------------------------------------------------- OH1KH · 2018-04-02 15:50 Yep it triggers. And If I create a new program with just form and memo (or edit). It works as you say. But If I try that on my old program it does not work. I have now make a bigger study where the difference is. It is just similar Edit, but program has several forms and it might be some kind of parent/child issue. Thanks anyway. Now I know that it is somehow possible and I can keep on trying.