What I want to do is to assign an anonymous method which I get as a function result to a variable of the same type. Delphi complains about not beeing able to do the assignement. Obviously Delphi things I want to assign the "GetListener" function instead of the result of that same function. Any help with this is very 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;