Hi Guys
I cannot go through with this. I want to create kind of popup menu dinamiacally with onClick event but I get errors.
Compile Project, Target: C:\Users\Dom\AppData\Local\Temp\project1.exe: Exit code 1, Errors: 2
unit1.pas(42,33) Error: Wrong number of parameters specified for call to "PopupMenuItemsClick"
unit1.pas(19,15) Error: Found declaration: PopupMenuItemsClick(TObject);
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus;
type
{ TForm1 }
TForm1 = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
procedure PopupMenuItemsClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
var
NewItem : TMenuItem;
Popupword :String ;
begin
Popupword := 'ddddddd';
NewItem := TMenuItem.Create(PopupMenu1);
PopupMenu1.Items.Add(NewItem);
NewItem.Caption := Popupword;
NewItem.OnClick := PopupMenuItemsClick; // Assign it an event handler.
end;
procedure TForm1.PopupMenuItemsClick(Sender: TObject);
begin
ShowMessage('item clicked');
end;
end.
Thanks