Selection in the memo is lost when it loses focus. lazarus / 31-LCL ---------------------------------------------------------------------- fedkad · 2021-08-26 14:09 Create a new GUI project and add a Memo and a Button to the empty form. Add a code like this to the action OnClick of button1: 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 ShowMessage('Something');memo1.Setfocus; At runtime, enter some data to the memo and select it. Click the button. The message Something will be displayed, but the selection in the memo will be lost. This happens only in Linux, but not in Windows. My system: Lazarus 2.0.12 (64-linux-gkt2) ---------------------------------------------------------------------- Tony Stone · 2021-08-26 16:12 I was having some sort of similar sittuation with text selection of a TEdit.  I remember toggling the AutoSelect option of the TEdit...  now maybe that is something you can find in a memo.  Not sure.  I would look for properties like that while you wait for someone who actually knows to answer you here. ---------------------------------------------------------------------- winni · 2021-08-26 17:07 Hi! Memo in Linux: If a Memo looses the focus then the Memo.selLength is set to 0 but the selstart remains. Copy the selLength to a private integer whenever the memo changes: onChange event of the memo. If the memo gains the focus again, then set  the Memo.SelLength again. And: you should do the same for the selStart: When you click on a memo, a new selstart is set - if you hit the text area. Winni ---------------------------------------------------------------------- fedkad · 2021-08-27 07:44 @Tonny Stone: The AutoSelect property has quite a different purpose. It is also not available in Tmemo. @winni: This "workaround" is something that I am aware of. However, I am developing a multi-platform program (Windows and Linux) and there are many places that should be modified like this. Also having this strange behavior in Linux is not something to be expected, so probably this should be considered a "bug".