var
  NewItem: TMenuItem;
  I : integer;
begin
  { first create the separator }
  NewItem := TMenuItem.Create(Self);
  NewItem.Caption := '-';
  { add the new item to the Windows menu }
  Windows.Add(NewItem);
  { now create and add a menu item for each form }
  for  I := 0 to Screen.FormCount-1 do
  begin
    NewItem := TMenuItem.Create(Self);
    NewItem.Caption := Screen.Forms[I].Name;
    Windows.Add(NewItem);  end;end;其它的就参考以上代码进行。

解决方案 »

  1.   

    yourcontrol.OnClick:=yourFunction;
    procedure TForm1.yourFunction(Sender: TObject);
    begin
    //
    end;
      

  2.   

    yourcontrol.OnClick:=yourFunction;类型不匹配。
    我的意思是动态生成的菜单项的Onclick.执行一个Function或指向一个Internet地址。
      

  3.   

    我用BCB
    增加声明:
    void __fastcall OnMyMenuClick(TObject* Sender);
    //然后实现它。然后,
    newitem.OnClick = OnMyMenuClick;
    生成菜单的时候,可以使用menuitem.Tag保存一个数据(例如指针或者索引号),例如:
    TMenuItem* pItem = new TMenuItem(MyMenu);
    pItem->Tag = Table1.RecordNo;
    然后,再Onclick的时候,通过Sender,得到recordno,再的到对应的数据,就可以了。