CopyToClipboard not working for TEdit lazarus / 31-LCL ---------------------------------------------------------------------- mtanner · 2017-08-15 08:17 I have a TEdit with some text in that I need to copy to the clipboard. With MyEdit do begin   SelectAll;   CopyToClipBoard; end; should work, it does in Delphi, but it does not. Clipboard.AsText:=MyEdit.Text; does work. ---------------------------------------------------------------------- Thaddy · 2017-08-15 09:43 It does not work the first time indeed, it works the second time, though. That's a bug. Tested arm-linux Raspbian-jessie ---------------------------------------------------------------------- ASerge · 2017-08-15 18:23 Quote from: Thaddy on August 15, 2017, 11:43:07 amIt does not work the first time indeed, it works the second time, though. That's a bug. Tested arm-linux Raspbian-jessie Under Windows works as expected. ---------------------------------------------------------------------- Bazzao · 2017-08-19 11:08 I had the same issue with a TMemo.  I tried Application.ProcessMessages while assembling the data in the Memo. I tried CopyToClipboard twice in a row. Even a few more times in a row, in case I had to bash Memo into submission. No luck, even with the violent coding.  Then I discovered the solution above, ("Clipboard.AsText:=MyEdit.Text;") and that worked. B ---------------------------------------------------------------------- Thaddy · 2017-08-19 11:39 Quote from: ASerge on August 15, 2017, 08:23:42 pmQuote from: Thaddy on August 15, 2017, 11:43:07 amIt does not work the first time indeed, it works the second time, though. That's a bug. Tested arm-linux Raspbian-jessie Under Windows works as expected. Yes I know, but not under linux -gtk 2. ---------------------------------------------------------------------- Bazzao · 2017-08-19 11:43 Now here is some evidence ... Originally I had the Memo as a variable under Private (Form), and the CopyToClipboard did not work. Thinking it was my coding, I added a Memo to the form and duplicated the code so the new Memo would receive data (it is used for concatenation). CopyToClipboard then worked.  So I deleted the original variable, hid the new Memo, and placed it down the Z order. CopyToClipboard then failed.  At that point I found the solution in this thread. After posting my previous reply, I commented out the solution, I made the Memo visible again, and the CopyToClipboard then worked. Weird. Violent coding does not work and neither does hiding things.  B ---------------------------------------------------------------------- dvhx · 2023-11-27 17:22 Nothing works for me, not even nuclear option: 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   with TStringList.Create do  try    Text := 'alpha';    SaveToFile('alpha.txt');    Text := 'beta';    SaveToFile('beta.txt');  finally    Free;  end;  with TProcess.Create(nil) do  try    CommandLine:= 'xclip -i -selection primary alpha.txt';    Options:= [poWaitOnExit];    Execute;    CommandLine:= 'xclip -i -selection secondary beta.txt';    Options:= [poWaitOnExit];    Execute;  finally    Free;  end;  sleep(1000); Clipboard in linux is beyond broken. Don't use it.