Actually the Delphi compatible code would be :
procedure TApp.Create(Sender: TObject);
begin
MyButton.SetOnClick(
procedure
begin
Alert('Button clicked');
end );
end;
There is no comas in the procedure declaration.
We have even created multicast anonymous methods in Mitov.Runtime so you can
add more than one anonymous methods to an event.
procedure TApp.Create(Sender: TObject);
begin
MyButton.OnClick.Add(
procedure
begin
Alert('Button clicked and called me');
end )
.Add(
procedure
begin
Alert('Button clicked and called me too');
end );
end;
With best regards,
Boian Mitov
-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------
From: Dmitry Boyarintsev
Sent: Tuesday, September 23, 2014 7:00 PM
To: FPC developers' list
Subject: Re: [fpc-devel] Suggestion: reference counted objects
About productive code. Should it look like this (note "Test" name is removed
from procedure declaration)?
procedure TApp.Create(Sender: TObject);
begin
MyButton.SetOnClick(procedure; begin
Alert('Button clicked');
end);
end;
thanks,
Dmitry
--------------------------------------------------------------------------------
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel