TCustomFormMenu (C++)
From RAD Studio Code Examples
Language:
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. Click the menu item or type CTRL+N to execute MyOnExecute.
Code
void __fastcall TForm1::Button1Click(TObject *Sender) { TMenuItem *Item1 = NewItem("New item", TextToShortCut("Ctrl+N"), false, true, MyOnExecute, 0, "Item1"); Menu = NewMenu(this, "MyMenu", &Item1, 0); } void __fastcall TForm1::MyOnExecute(TObject *Sender) { MessageDlg("Item1 has been executed.", mtInformation, TMsgDlgButtons() << mbOK, 0); }
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 )