unit ShortCut;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    FileCommand: TMenuItem;
    OpenCommand: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure OpenCommandClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: ShortCut
// Routine: Menus.ShortCut

// BeginCode
{
This example creates a shortcut, Ctrl+O, at run time and
assigns it to the Open command on a File menu.
}
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;
// EndCode
// EndExample: ShortCut
end.
