On Mon, Sep 29, 2014 at 11:54 PM, Dennis Poon <den...@avidsoft.com.hk> wrote: > 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 > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Simply: vObj := TObject(TMethod(TheEvent).Data); vMethodName := vObj.MethodName(TMethod(TheEvent).Code); ? Regards, Flávio _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal