ShortCutToText (Delphi)

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

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := Menus.ShortCutToText(OpenCommand.ShortCut);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OpenCommand.ShortCut := Menus.ShortCut(Word('O'), [ssCtrl]);
end;

procedure TForm1.OpenCommandClick(Sender: TObject);
begin
  MessageDlg('The Open command has been selected.', mtInformation, [mbOk], 0);
end;

Uses