Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect ctrl-t keypress in Delphi

Tags:

delphi

I have a Win32 form with a TEdit control. When the user presses CTRL-t while the TEdit control is in focus, I want to detect it using the OnKeyUp event. I need a code example, please, using the Key and/or Shift variables. Thanks.

like image 510
kenalacom Avatar asked Jun 08 '10 19:06

kenalacom


1 Answers

Set KeyPreview of the form to True, then write this code for OnKeyUp event of your form:

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if (Key = 84) and (Shift = [ssCtrl]) then
    ShowMessage('Ctrl+t is pressed!');
end;
like image 129
vcldeveloper Avatar answered Oct 12 '22 12:10

vcldeveloper