What I want to do is assign an anonymous method, which I get as the result of a function for a variable of the same type. Delphi complains that she will not be able to complete the task. Obviously, with Delphi stuff, I want to assign a GetListener function instead of the result of the same function. Any help with this is much appreciated.
type TPropertyChangedListener = reference to procedure (Sender: TStimulus); TMyClass = class function GetListener:TPropertyChangedListener end; .... var MyClass: TMyClass; Listener: TPropertyChangedListener; begin MyClass:= TMyClass.create; Listener:= MyClass.GetListener; // Delphi compile error: E2010 Incompatible types: TPropertyChangedListener' and 'Procedure of object' end;
anonymous-methods delphi delphi-2009
iamjoosy
source share