iOS Question How to Raise an Event Sub in Page Root from a Class Module?

Falcon

Member
Licensed User
Hi Experts,

In B4A I could raise an event sub in the Main Activity from a Class Module by passing the Main Activity to my Class Module when I initialized it like so:

B4X:
MyModule.Initialize(Activity,"MyModule")

Then in the Main Activity I had:
B4X:
Sub MyModule_SomeEvent(SomeParameter as string)
   '...do something
End Sub

I could then raise the 'SomeEvent' sub in the Main Activity from the Class Module like so (I made the 'Main' variable = Activity):
B4X:
If SubExists(Main, "MyModule_SomeEvent") = True Then
       CallSub2(Main, "MyModule_SomeEvent", SomeParameter)
End If

But when I try to do something similar in B4i using the PageRoot (instead of Activity) I get an 'Invalid Component' error, in other word it does not like the fact that I am trying to use PageRoot instead of Activity. How do I do this in B4i?

Thank you very much for your time,

Regards
Jacques.
 

Falcon

Member
Licensed User
Never mind, I figured it out.

For those also battling with this, you just do this (from within the Class Module):
B4X:
Main.MyModule_SomeEvent(MyParameter)
 
Upvote 0
Top