TMemo selection after focus loss lazarus / 31-LCL ---------------------------------------------------------------------- sfeinst · 2010-05-08 13:25 I've noticed with the apps I've built, that when I select something in a TMemo and the focus is lost (a dialog is displayed for example), the selection disappears.  I've tried this in other apps (notepad for example) and the selection stays on those.  Is this just how TMemo works or is there a property I can set to keep showing the selection? ---------------------------------------------------------------------- typo · 2010-05-08 16:04 Set the property HideSelection to False. ---------------------------------------------------------------------- sfeinst · 2010-05-09 23:49 Quote from: typo on May 08, 2010, 06:04:11 pmSet the property HideSelection to False. On what control?  I looked at TMemo and I do not see a HideSelection property. ---------------------------------------------------------------------- Martin_fr · 2010-05-10 00:02 What version of lazarus do you have? It exists in the latest SVN version. Maybe it is not published in older Lazarus, then you may still be able to set it from within your code Memo1.HideSelection := False; ---------------------------------------------------------------------- sfeinst · 2010-05-10 11:23 Quote from: Martin_fr on May 10, 2010, 02:02:52 amWhat version of lazarus do you have? It exists in the latest SVN version. Maybe it is not published in older Lazarus, then you may still be able to set it from within your code Memo1.HideSelection := False; I am running version 0.9.28.2 beta under Windows.  Under Linux, I am running the same (I think - not at the machine to look at the actual version).  I tried in code, but, that option is not available.  So it looks like I will either need to pull from SVN or wait until a newer version becomes available from Linux distribution. ---------------------------------------------------------------------- sfeinst · 2010-05-13 10:35 OK.  I downloaded the latest from trunk (0.9.29) and I see there is now a HideSelection property.  I tried setting the property in the object browser and in code.  I tested the value with a showmessage and see it is set to false.  But it does not seem to work for me (testing under Windows).  When the tmemo loses focus, the selection disappears. ---------------------------------------------------------------------- Martin_fr · 2010-05-13 11:39 Indeed, the feature got broken... Now that's a catch 22. You have no choice but to use the daily snapshot, but the daily snapshot is broken... (snapshots are explicitly marked as having a high risk of getting broken) anyway, will be fixed in tomorrows snapshot. (or svn right now) Or if you do not want to wait, apply below patch: Code: [Select]Index: win32wsstdctrls.pp =================================================================== --- win32wsstdctrls.pp (revision 25364) +++ win32wsstdctrls.pp (revision 25365) @@ -1249,6 +1249,8 @@        Flags := Flags or ES_AUTOHSCROLL;      if ACustomMemo.BorderStyle = bsSingle then        FlagsEx := FlagsEx or WS_EX_CLIENTEDGE; +    if not ACustomMemo.HideSelection then +      Flags := Flags or ES_NOHIDESEL;      pClassName := @EditClsName[0];      WindowTitle := StrCaption;    end; ---------------------------------------------------------------------- sfeinst · 2010-05-13 13:23 Pulled from SVN.  Works fine now thanks.