Undo and CanUndo in TMemo lazarus / 31-LCL ---------------------------------------------------------------------- lucamar · 2018-09-01 18:00 The environment Lazarus 1.8.4 (GTK2) / FPC 3.0.4Kubuntu 14.04 / Ubuntu 10.10The program It's a very simple program: just a form with a TMainMenu, a TMemo, some actions and little else. In the main menu there is---among others ---a top-level item "Edit" with a submenu of items "Undo, "Cut", "Copy", "Paste", etc. The handlers for items "Edit" and "Undo" are these: 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 TMain.itEditClick(Sender: TObject);begin  itEditUndo.Enabled := Memo.CanUndo;  {itEditRedo.Enabled := False;}{ No redo for the wicked!? }  itEditCut.Enabled := (Memo.SelLength > 0) and (not Memo.ReadOnly);  itEditCopy.Enabled := (Memo.SelLength > 0);  itEditPaste.Enabled := (not Memo.ReadOnly) and                         Clipboard.HasFormat(CF_Text);  {... etc. sniped for the forum ...}end; procedure TMain.itEditUndoClick(Sender: TObject);begin  Memo.Undo;end; The problem Whatever I do: type, paste, delete, etc. Memo.CanUndo is always false. Even if I comment out the line:     itEditUndo.Enabled := Memo.CanUndo; and keep the item itEditUndo always enabled, Memo.Undo, of course, does nothing. The question(s) Is this some bug (in GTK, perhaps)? As designed? Fixed somewhere? Can't (or will never) be fixed? Am I going mad? The notes I seem to remember that this worked on Windows, but I can't test ATM because my Windows boxes are undergoing surgery. Any help, anyone? ---------------------------------------------------------------------- Handoko · 2018-09-01 18:32 I remember there were some discussions about it. I didn't follow the discussions, maybe you can find something useful from them: https://forum.lazarus.freepascal.org/index.php/topic,37484.msg251927.h tml#msg251927 https://forum.lazarus.freepascal.org/index.php/topic,38661.msg263312.h tml#msg263312 https://forum.lazarus.freepascal.org/index.php?topic=41279.0 ---------------------------------------------------------------------- lucamar · 2018-09-01 19:46 Thanks, Handoko; I forgot the first rule of posting: search before doing anything else  So the answer is: it's a well known bug about which, apparently, nobody cares enough to fix properly. Well, I'll see what I can do to implement something like it. Thanks again! ---------------------------------------------------------------------- taazz · 2018-09-01 22:46 Quote from: lucamar on September 01, 2018, 09:46:04 pmThanks, Handoko; I forgot the first rule of posting: search before doing anything else  So the answer is: it's a well known bug about which, apparently, nobody cares enough to fix properly. I'm under the impression that gtk is in the process of phasing out in favor of gtk 3. In which case I would try to test with gtk3 and see if you can convince the authors to add it on gtk3 now that its still under development. Quote from: lucamar on September 01, 2018, 09:46:04 pmWell, I'll see what I can do to implement something like it. Thanks again! https://forum.lazarus.freepascal.org/index.php/topic,40205.0.html here this should get you there faster. ---------------------------------------------------------------------- lucamar · 2018-09-01 23:59 Alas! I need it on Gtk2 too, so it's me for the grinding-wheel ... although your link may make it less "grinding". Thanks, Taaz