Mega Code Archive

 
Categories / Delphi / Functions
 

Undo function with TMemo

Title: Undo function with TMemo Question: Several tasks can be solved by knowing the internal messages of the VCL. Answer: A undo function of TMemo can be best realized by useing the EM_UNDO message of the VCL: procedure TForm1.ButtonUndoClick(Sender: TObject); begin Memo1.Perform(EM_UNDO, 0, 0); end; With EM_CANUNDO you can check if a undo is possible: procedure TForm1.Timer1Timer(Sender: TObject); begin Button1.Enabled := Memo1.Perform(EM_CANUNDO, 0, 0) 0; end;