<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 18.04.2016 10:18, Jonas Maebe wrote:<br>
</div>
<blockquote cite="mid:5714985F.40902@elis.ugent.be" type="cite">Delphi
does not support assigning procedures to variables representing
anonymous functions</blockquote>
<br>
It does. Both for procedure of object and plain procedure:<br>
<br>
<small><tt>program Project1;</tt><tt><br>
</tt><tt><br>
</tt><tt>{$APPTYPE CONSOLE}</tt><tt><br>
</tt><tt><br>
</tt><tt>{$R *.res}</tt><tt><br>
</tt><tt><br>
</tt><tt>uses</tt><tt><br>
</tt><tt> System.SysUtils;</tt><tt><br>
</tt><tt><br>
</tt><tt>type</tt><tt><br>
</tt><tt> TRefProc = reference to procedure;</tt><tt><br>
</tt><tt><br>
</tt><tt> TMyObj = class(TObject)</tt><tt><br>
</tt><tt> public</tt><tt><br>
</tt><tt> procedure Test2;</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><tt><br>
</tt><tt> procedure Test;</tt><tt><br>
</tt><tt> begin</tt><tt><br>
</tt><tt> Writeln('hello');</tt><tt><br>
</tt><tt> Readln;</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><tt><br>
</tt><tt>{ TMyObj }</tt><tt><br>
</tt><tt><br>
</tt><tt>procedure TMyObj.Test2;</tt><tt><br>
</tt><tt>begin</tt><tt><br>
</tt><tt> Writeln('hello2');</tt><tt><br>
</tt><tt> Readln;</tt><tt><br>
</tt><tt>end;</tt><tt><br>
</tt><tt><br>
</tt><tt>var</tt><tt><br>
</tt><tt> xR: TRefProc;</tt><tt><br>
</tt><tt> xO: TMyObj;</tt><tt><br>
</tt><tt>begin</tt><tt><br>
</tt><tt> xR := Test;</tt><tt><br>
</tt><tt> xR();</tt><tt><br>
</tt><tt><br>
</tt><tt> xR := xO.Test2;</tt><tt><br>
</tt><tt> xR();</tt><tt><br>
</tt><tt>end.</tt><tt><br>
</tt></small><br>
Ondrej<br>
</body>
</html>