<div>I need to execute an procedure of an object if his exists, i'm doing some tests and get into this, but this is generating an SIGSEV:</div><div> </div><div>unit Unit1;</div><div> </div><div>{$mode objfpc}{$H+}</div>
<div> </div><div>interface</div><div> </div><div>uses<br> Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;</div><div> </div><div>type</div><div> { TTeste }</div><div> TTeste = class<br> procedure Proc;<br>
end;</div><div> </div><div>type</div><div> { TForm1 }</div><div> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { private declarations }<br> public<br>
{ public declarations }<br> end;</div><div> </div><div>var<br> Form1: TForm1;</div><div> </div><div>type<br> TProc = procedure of object;</div><div> </div><div>implementation</div><div> </div><div>procedure DoProc(Sender: TObject);<br>
var<br> Proc: TProc;<br>begin<br> Proc := TProc(Sender.MethodAddress('Proc')^);<br> Proc;<br>end;</div><div> </div><div>{ TTeste }</div><div>procedure TTeste.Proc;<br>begin<br> ShowMessage('oi');<br>end;</div>
<div> </div><div>{$R *.lfm}</div><div> </div><div>{ TForm1 }</div><div>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> DoProc(TTeste.Create);<br>end;</div><div> </div><div>end.</div><div> </div><div><br><br>
</div><div class="gmail_quote">2012/3/27 Everton Vieira <span dir="ltr"><<a href="mailto:tonvieira@gmail.com">tonvieira@gmail.com</a>></span><br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div>Is there any how to list the procedures of a object?<br></div><div>Att.</div><span class="HOEnZb"><font color="#888888"><div>Everton Vieira.<br>
</div>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Everton Vieira.<br>