CurrentMethodName

From Xojo Documentation

Constant As String / Text

anString / Text = CurrentMethodName

Contains the fully-qualified name of the method or event that it is in.

Usage

result = CurrentMethodName

Part Type Description
result String / Text The name of the method or event that contains the constant.

Notes

Returns Text on iOS, String elsewhere.

You can use this for logging purposes to identify methods that were called and code that was run.

The CurrentMethodName constant automatically contains the fully-qualified name of the method or event that contains the constant. It is equivalent to a manual declaration such as

Const CurrentMethodName = "methodName"

Where methodName is the fully-qualified name. For example, if you create a method on Window1, "MyMethod," then CurrentMethodName will equal "Window1.MyMethod".

Sample Code

This logs the method name when it runs:

System.DebugLog("MyApp: " + CurrentMethodName)

See Also

Sub, Function statements.