Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What procedure called this method?

Status
Not open for further replies.

Griffyn

Programmer
Jul 11, 2002
1,077
AU
Hi all,

To replicate the subject line - Is there a way for an object method to know (as a String) what method/procedure/function called it? Like the call stack debug window?

I can work around this using a flag when calling the method, but I'm thinking it would be more elegant the call stack way.

Thanks.
 
If you're trying to find the "path" which was taken before an exception was raised then i suggest you check out EurekaLog if you haven't already.
I find it very useful when tracing different exceptions.

Also you might find useful the Project Jedi files. There is a unit called JclDebug. I haven't used it but i know it's there. And it's open source.


Hope you get something out of these.
 
Didn't know about Jedi - looks like a heap of useful stuff, unfortunately I couldn't find any code snippets for what I'm after.

To be clear, I'm not try to track exceptions or anything like that. I have a single method that is called from 3 other separate methods - two of which are 2 layers down in the call stack. I need my single method to do something special when it code pathway comes from one of those 3 methods.

As I indicated, I could achieve this by adding a flag to the object that's set by all 3 methods, but down the track I may find this impossible because this project makes use of the RTTL to call many methods whose names are pulled from database tables. It would quickly get out of hand. But - unless somebody has a way for me to do this, I'll start coding it using the flag technique and see how I go.

Thanks Pikkunero.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top