Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Sep : passing address of procedure to another class
| Subject: | passing address of procedure to another class |
| Posted by: | "Jack Morano" (jackmoran..@gmail.com) |
| Date: | Sun, 17 Sep 2006 20:31:40 |
Hi,
I have the following code:
type TProcAsParam = procedure (Name:string) of object;
type TMyFirstClass=class
private
FSecondClass:TMySecondClass;
procedure DoSomeAction(Name:string);
procedure InitObjects;
end;
type TMySecondClass=class
public
constructor Create(const MyProcedure:TProcAsParam);
end;
procedure TMyFirstClass.InitObjects;
begin
FSecondClass:=TMySecondClass.Create(@self.DoSomeAction)
end
procedure TMyFirstClass.DoSomeAction(Name:string);
begin
//...code here
end
I need to pass the address of TMyFirstClass.DoSomeAction to
TMySecondClass but i get error "Variable required".
Could anyone help me with this ?
Thanks,
J.Morano