When creating an object that raises an event, is it possible to automatically address the caller module?
In the following example, the testobject object raises an event: in the Initialize sub, I used Me to specify the current module.
Is there another way to do it, so the Initialize sub can have only the "event" parameter and not the callback one, since it will always be "Me"?
It should be possible, since the Serial library object has only "eventname" in the Initialize sub.
In the following example, the testobject object raises an event: in the Initialize sub, I used Me to specify the current module.
Is there another way to do it, so the Initialize sub can have only the "event" parameter and not the callback one, since it will always be "Me"?
It should be possible, since the Serial library object has only "eventname" in the Initialize sub.
Main:
Sub Process_Globals
Dim t As testobject
End Sub
Sub AppStart (Args() As String)
Log("Hello world!!!")
t.Initialize(Me, "evento")
t.RaiseEvent
End Sub
Sub evento
Log("evento")
End Sub
testobject:
Sub Class_Globals
Dim mcallback As Object
Dim mevent As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(callback As Object, event As String)
mcallback = callback
mevent = event
End Sub
Public Sub RaiseEvent
CallSub(mcallback, mevent)
End Sub