I know that if I declare a method to a form, like:
procedure ButtonCancelClick(Sender: TObject);
I can assign that to the button:
btnCancel.OnClick := ButtonCancelClick;
But in this case, I don't have a form previously created. I mean, I created a Form at run time, and I'm adding some buttons and I want to add some events to the clicks of the buttons.
So, without the procedure being in a form, I get the error:
Incompatible types: 'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter'