GetCallerName Procedure |
Version 6 (134a), 7.0 |
Rerturns the current or caller procedure name or test id name.
[ sCallerName = ] GetCallerName ( [iIndex] )
The GetCallerName procedure syntax has the following parts:
Name |
Type |
Description |
sCallerName |
String |
Current call stack procedure name (or test id) for the given index |
iIndex |
Val Long |
0 for current (' this') procedure, 1 (default value) for direct caller, etc... |
The function returns a string that contains a procedure name or a test id name.
If a procedure name is returned, it will be in the format :
ModuleDocitemName.[FormName.][Control/MenuName.]ProcName
a string delimited by dot which represents the procedure symbol's absolute path. For example, if 'Initialize' is a form procedure, then GetCallerName(0) in the procedure returns "TestExec.formTestExec.Initialize".
The function can be used to find out the caller or callers of this procedure as well as to find the current code container (procedure or test) name.
The following example prints to the Debug log window a procedure if called and if an error occurred, it reports the caller:
Procedure MyProcedure(): Void
--------------------------------------------------------------------------------
{
Trace GetCallerName(0); " was called"
....
if bError
TraceError(103)
return
endif
....
}
Procedure TraceError(iError): Void
--------------------------------------------------------------------------------
iError: Val Long
{
Trace "Error #"; iError;"in : ";GetCallerName(); ", Called by : "; GetCallerName(2)
}