Free Pascal > Unix

Help: Drop text to TMemo from another Application

(1/3) > >>

OH1KH:
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:
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:
Can't you call Memo.SelectAll in the OnDragDrop code as first statement?

GetMem:

--- Quote ---Seems that that nobody does know solution for this! Over 200 times read, with no suggestions at all.

--- End quote ---
Perhaps people are busy with other things...


--- Quote ---But that is a work around, not solution
--- End quote ---
You have an OnDropFiles event(Form1) just clear the memo there and you're good to go:

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of String);begin  Memo1.Clear;end;

Soner:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version