[Lazarus] List the procedures of a object.

Everton Vieira tonvieira at gmail.com
Tue Mar 27 18:54:34 CEST 2012


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:

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type
  { TTeste }
  TTeste = class
    procedure Proc;
  end;

type
  { TForm1 }
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

type
  TProc = procedure of object;

implementation

procedure DoProc(Sender: TObject);
var
  Proc: TProc;
begin
  Proc := TProc(Sender.MethodAddress('Proc')^);
  Proc;
end;

{ TTeste }
procedure TTeste.Proc;
begin
  ShowMessage('oi');
end;

{$R *.lfm}

{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
  DoProc(TTeste.Create);
end;

end.




2012/3/27 Everton Vieira <tonvieira at gmail.com>

> Is there any how to list the procedures of a object?
> Att.
> Everton Vieira.
>



-- 
Everton Vieira.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120327/9b0c0a01/attachment-0003.html>


More information about the Lazarus mailing list