I was wondering if there is a way in Delphi to assign an anonymous method to a form control event.
For instance:
Button1.OnClick := procedure (Sender: TObject) begin ShowMessage('') end;
Of course this gives me an error
[dcc32 error] Control.Controller.pas (51): E2009 Incompatible types: "method pointer and regular procedure"
This is because the method must belong to the object, but then it will not be anonymous.
Perhaps there are several works for this
source share