Memo Question(Solved) lazarus / 61-Beginners ---------------------------------------------------------------------- JLWest · 2022-10-01 16:51 There is a Memo1 on Form1. The user edits the Memo. Is there a way to detect the edit. I don't need to know what was edited just that an edit occurred so a save of the memo can occur on exit of the memo. Thanks. ---------------------------------------------------------------------- Arioch · 2022-10-01 16:55 TMemo.OnChange ? ---------------------------------------------------------------------- Bart · 2022-10-01 16:59 Memo1.Modified? ---------------------------------------------------------------------- Thaddy · 2022-10-01 17:00 Yes, or OnKeyUp, which is safer... ---------------------------------------------------------------------- Arioch · 2022-10-01 17:04 Quote from: Thaddy on October 01, 2022, 07:00:17 pmYes, or OnKeyUp, which is safer... what if i r-click and do paste without hitting keyboard ? ---------------------------------------------------------------------- paweld · 2022-10-01 17:46 Events OnEnter and OnExit: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 uses  sha1; var  memosha: String = ''; procedure TForm1.Memo1Enter(Sender: TObject);begin  Label1.Caption := '';  Label1.Color := clBtnFace;  memosha := SHA1Print(SHA1String(Memo1.Lines.Text));end; procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);begin  Memo1Exit(Sender);end; procedure TForm1.Memo1Exit(Sender: TObject);begin  if memosha <> SHA1Print(SHA1String(Memo1.Lines.Text)) then  begin    Label1.Caption := 'Text has been changed';    Label1.Color := clRed;    //or save changes here  end  else  begin    Label1.Caption := 'Text has NOT been changed';    Label1.Color := clLime;  end;  memosha := '';end; ---------------------------------------------------------------------- JLWest · 2022-10-01 18:22 Thanks All: I'll test each answer.  Kinda of unhappy I didn't think of this and try a few thing out before posting. ---------------------------------------------------------------------- Arioch · 2022-10-01 18:41 ahem... so i have a form, and two memos on it, and i just keep pressing TAB key - cycling through the memos all the memos would have OnEnter / OnKeyDown / OnKeyUp /  OnExit events yet no text would be actually changed come on... ---------------------------------------------------------------------- paweld · 2022-10-01 18:52 @Arioch: I don't know if you're referring to my post - I actually didn't give a description, but I posted sample code: after entering the memo, I calculate the hash of the current text, which is also calculated on exit and compared with the initial one. Based on this, it is checked whether a modification has occurred - this is resistant to undoing changes. ---------------------------------------------------------------------- Arioch · 2022-10-01 19:09 frankly, if i would use the same idea then i'd do it "in your face" way: i woud compare the text itself, rather than hash we have a "vanilla text" anyway, before we overwrote it, so - just compare with it :-) ---------------------------------------------------------------------- jamie · 2022-10-01 21:28 Quote from: Bart on October 01, 2022, 06:59:37 pmMemo1.Modified? Didn't anyone notice Bart ? The MODIFIED property was put in there just to determine if user made changes verses software changes.. Ensure you clear it at some point because it does retain the last setting.