I have a class to which I would really prefer not to pass the Callback and EventName parameters. The example is just illustrative.
Real example
What I need (if this is possible), the class name is 'ClassTestName'
Real example
B4X:
'In a Class
#Event: Error (Msg As String)
Sub Class_Globals
Private mCallBack As Object
Private mEvent As String
End Sub
Public Sub Initialize(CallBack As Object, EventName As String)
mCallBack = CallBack
mEvent = EventName
End Sub
'In B4XPage
Sub Class_Globals
Private obj As objClass
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
obj.Initialize(Me, "CustomEventName")
End Sub
Private Sub CustomEventName_Error(Msg As String)
'Error handling
End Sub
What I need (if this is possible), the class name is 'ClassTestName'
B4X:
#Event: Error (Msg As String)
Sub Class_Globals
Private mCallBack As Object
Private mEvent As String
End Sub
Public Sub Initialize()
mCallBack = Me.Parent
mEvent = Me.Parent.NameOfClass 'Return ClassTestName
End Sub
Private Sub ClassTestName_Error(Msg As String)
'Error handling
End Sub