0

Disclaim: I am asking to "Lazarus" because I don't really care about mode Delphi or mode ObjFPC...

I am translating some code from "Delphi 11" to Lazarus and found those:

TProc = reference to procedure(const AControl: TControl);
....
proc := MyProcedure;

This seems to be some managed reference to method for event callback, if I am correct.

How would I make something equivalent under Lazarus ?

1 Answer 1

4

You can use FPC from the main branch, which has this feature since May of last year. However, it will only be in the next major version release, which is not on the horizon, as far as I know.

Official announcement of the feature:

Feature announcement: Function References and Anonymous Functions

3
  • Thank you for this reply. I will still look some some equivalent code (I am working with cross-compilation tool-chain, which can be tedious to recreate) Feb 7 at 12:17
  • 1
    @AdrianMaire there is no other equivalent. You could rewrite your code to procedure of object and then use normal event procedures / functions Feb 7 at 20:03
  • Currently there will be another 3.2(.4) point release before trunk will become the source for releases Mar 12 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.