ShortCutToText (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This line creates a shortcut, Ctrl+O, at run time and assigns it to the Open command on a File menu.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Edit1->Text = ShortCutToText(OpenCommand->ShortCut);}

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  OpenCommand->ShortCut =
    ShortCut(Word('O'), TShiftState() << ssCtrl);
}

void __fastcall TForm1::OpenCommandClick(TObject *Sender)
{
  MessageDlg(
	"The Open command has been selected.",
	mtInformation,
	TMsgDlgButtons() << mbOK,
	0);
}

Uses