[fpc-pascal] how do I get Run Time info from a published method?

Dennis Poon dennis at avidsoft.com.hk
Tue Sep 30 04:54:16 CEST 2014


say for example:

   type
      TmyClass = class
      published
         procedure Something (sender : Tobject);virtual;
     end;

var
   myClass  : TmyClass;

then somewhere

     AddMethodToQueue(@myclass.Something);


Is it possible within AddMethodToQueue, I can query the Run Time Type 
Info of the method passed in ?



procedure AddMethodToQueue(const TheEvent : TNotifyEvent);
var aMethodObjectname : String;
begin
     //I can already do this
      aMethodObjectName := TObject(TMethod(TheEvent).Data).ToString;

     //how do I check the RTTI of TheEvent and get the name of the 
method i.e. 'Something'?
    //since it is published, it should be possible, right?

end;

Thanks in advance.

Dennis



More information about the fpc-pascal mailing list