Board index » delphi » How to get the name of an event?

How to get the name of an event?


2004-09-14 10:43:17 PM
delphi173
I would like to gather some testing and logging data from my DB app's
different events. Currenly my code looks something like this:
procedure TXOrderF1.OrdersAfterPost(DataSet: TDataSet);
begin
AddLogInfo(DataSet.Name +' AfterPost');
...
procedure TXOrderF1.ItemsBeforePost(DataSet: TDataset);
begin
AddLogInfo(DataSet.Name +' BeforePost');
...
procedure TXOrderF1.OrdersBeforePost(DataSet: TDataset);
begin
AddLogInfo(DataSet.Name +' BeforePost');
...
Procedure AddLogInfo is my code that writes the DB events and the
current Time to the LOG-file.
As seen, I currently get the name of the appropriate DataSet in the
event, but I'd want to get the names of the events, like
'OrdersBeforePost', 'OrdersAfterPost', etc, so I'd not need to write
them separately like I currently do.
So is it possible to get those names? Thanks a lot for any answers.
(I hope this was the right group to ask this question.)
Jan Huhta
 
 

Re:How to get the name of an event?

Author := "Jan Huhta";
| As seen, I currently get the name of the appropriate DataSet in the
| event, but I'd want to get the names of the events, like
| 'OrdersBeforePost', 'OrdersAfterPost', etc, so I'd not need to
| write them separately like I currently do.
It is possible. You can use Jedi Code Library (speifically unit
JclDebug.pas) that loads the project's map file in memory and uses it
to get information on the current call stack. Also it includes an IDE
package that will automatically pack the compiler-generated map file
and insert it in the compiled exe as a binary resource (IIRC) so that
it is easier to maintain/distribute.
JCL: jcl.sourceforge.net
| (I hope this was the right group to ask this question.)
I think not, the correct one would be b.p.d.language.delphi.general.
--
"If something hits the fan it is not distributed evenly."