For logging bugs it may be useful to know where you are. For example you may want to log a problem and include where you are in the code.
You can query the window or control class names with Introspection. With me you refer to the control or with self you refer to current window. The Xojo language adds a CurrentMethodName constant to each method.
EventHandler Sub Pressed()
// query which window we are inside:
System.DebugLog "Window Class Name: "+Introspection.GetType(Self).name
System.DebugLog "Window Title: "+Self.Title
// which control we are inside:
System.DebugLog "Control Class Name: "+Introspection.GetType(Me).name
System.DebugLog "Control Name: "+Me.name
// current method as constant
System.DebugLog "Current Method Name: "+CurrentMethodName
// and use exception to get caller
System.DebugLog "Caller Name: "+GetCallerName
Here is a little helper function to query the caller name by raising and catching an exception:
Function GetCallerName() As String
#Pragma BreakOnExceptions False
Dim r As New RuntimeException
Catch r As RuntimeException
dim names() as string = r.Stack
// 0 = Raise
// 1 = GetCallerName
// 2 = Method calling GetCallerName
// 3 = Caller
The BreakOnExceptions pragma avoids the IDE stopping at that line.
Let us know if you have questions.
20 08 23 - 09:55