Mega Code Archive

 
Categories / Delphi / Functions
 

How to add the Select All (CTRL+A) functionality to TMemoTDBMemo

Title: How to add the "Select All (CTRL+A)" functionality to TMemo/TDBMemo Question: How to add the "Select All (CTRL+A)" functionality to TMemo/TDBMemo. Answer: To implement the code for the CTRL+A key combination ("Select All") for TMemo, TDBMemo or any of it's descendants implement the following code on the OnKeyDownEvent: procedure OnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState) ; begin if (Key = Ord('A')) and (ssCtrl in Shift) then begin TMemo(Sender).SelectAll; Key := 0; end; end;