Mega Code Archive

 
Categories / Delphi / VCL
 

Performing undo on an edit control

Question: How can I programmatically undo changes in an edit type control? Answer: You can use: Memo1.Perform(EM_UNDO, 0, 0); If you want to check whether undo is available, so you can enable or disable a menu item choice, you can check the "Undo status" like this: If Memo1.Perform(EM_CANUNDO, 0, 0) <> 0 then begin {Undo is possible} end; To preform a "Redo" simply "Undo" a second time.