TMenuItemInsert (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code inserts a menu item after the first item in a menu named FileMenu.

Code

void __fastcall TForm1::InsertMenuItemClick(TObject *Sender)
{
  TMenuItem *NewItem = new TMenuItem(FileMenu);
  try
  {
    NewItem->Caption = "Form1";
    FileMenu->Insert(1, NewItem);
  }
  catch (Exception &e)
  {
    delete NewItem;
    throw;
  }
}

Uses