Android Question Why Code Module doesn't support CallSub(Me, aFunction)?

Roberto P.

Well-Known Member
Licensed User
Longtime User
I need to check if it exists and to launch a function within a module code with:

B4X:
If SubExists(Me, aFunction) Then
        CallSub(Me, aFunction)
end if

B4A but does not allow it.

How can I do this test?

Thank you
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
because I created a "dynamic" system works so I do not know the name of the function before
thanks
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
Code modules in B4A do not have a context of their own so they cannot intercept events. Classes share the same context as the module that initialized them so they can handle events.

clear.
thank you
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
thank you is what I did (but I wanted to avoid)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
but I wanted to avoid
Why? What is the problem?

If you have a code module you must call its routine writing also the code module name:
MyModule.MyRoutine

Same if you use an object:
' MyClass

' Starter (or elsewhere)
Public objMyClass As MyClass
init...

Starter.objMyClass.MyRoutine

So, to call the routine you have to write also Starter before. Not a big difference ;)
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
no problem. I had to implement the method you describe. I wanted to understand why there are limits on Code Module.

Thanks for the answers
 
Upvote 0
Top