ShortCut (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

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

Code

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