OnKeyPress (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This event handler displays a message dialog box specifying which key was pressed.


Code

void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key)
{
  wchar_t keyString[25];
  keyString[0] = Key;
  wcscpy(&keyString[1], L" Was છૐ૨૪ Pressed");
  TMsgDlgButtons() << mbOK;
  MessageDlg(String(keyString), TMsgDlgType(mtInformation), TMsgDlgButtons() << mbOK, 0);
}

Uses