How to detect ctrl-t keypress in Delphi

前端 未结 1 1680
野性不改
野性不改 2021-02-20 06:56

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,

相关标签:
1条回答
  • 2021-02-20 07:29

    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;
    
    0 讨论(0)
提交回复
热议问题