TCustomFormMenu (Delphi)
Description
This code displays a new menu named MyMenu when you click the button. MyOnExecute must be included in the definition of the TForm1 class.
Code
procedure TForm1.Button1Click(Sender: TObject);
begin
Menu := NewMenu(Self, 'MyMenu',
[NewItem('New item', TextToShortCut('Ctrl+N'),
False, True, MyOnExecute, 0, 'Item1')]);
end;
procedure TForm1.MyOnExecute(Sender: TObject);
begin
MessageDlg('Item1 has been executed.', mtInformation, [mbOK], 0);
end;
Uses
- Vcl.Forms.TCustomForm.Menu ( fr | de | ja )
- Vcl.Menus.NewMenu ( fr | de | ja )
- Vcl.Menus.NewItem ( fr | de | ja )
- Vcl.Menus.TextToShortCut ( fr | de | ja )