I have a problem. I'm creating a dynamic button (for example like that:
var MyButton: TButton;
...
MyButton:=TButton.Create(Self);
MyButton.Top:=2;
MyButton.Left:=2;
MyButton.Width:=200;
MyButton.Height:=28;
MyButton.Caption:='MyButton';
)
And now how to assign a method to a dynamic button? Such thing should work: MyButton.OnClick:=MyForm.MyButtonClick;
Unfortunately, it doesn't do anything except halting compilation and calling an error: Wrong number of parameters... Of course, compiler is trying to assign a return value of MyButtonClick method. How to solve this problem??