Roberto P. Well-Known Member Licensed User Longtime User Sep 20, 2016 #1 I need to check if it exists and to launch a function within a module code with: Code: Copy If SubExists(Me, aFunction) Then CallSub(Me, aFunction) end if B4A but does not allow it. How can I do this test? Thank you
I need to check if it exists and to launch a function within a module code with: Code: Copy 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 Sep 20, 2016 #2 because I created a "dynamic" system works so I do not know the name of the function before thanks Upvote 0
LucaMs Expert Licensed User Longtime User Sep 20, 2016 #3 You can create a class, instead of a code module; simply move all routines there Upvote 0
Roberto P. Well-Known Member Licensed User Longtime User Sep 21, 2016 #4 LucaMs said: You can create a class, instead of a code module; simply move all routines there Click to expand... Because I need to to call the static function of the form of several parts Upvote 0
LucaMs said: You can create a class, instead of a code module; simply move all routines there Click to expand... Because I need to to call the static function of the form of several parts
Erel B4X founder Staff member Licensed User Longtime User Sep 21, 2016 #5 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. Upvote 0
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.
Roberto P. Well-Known Member Licensed User Longtime User Sep 21, 2016 #6 Erel said: 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. Click to expand... clear. thank you Upvote 0
Erel said: 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. Click to expand... clear. thank you
LucaMs Expert Licensed User Longtime User Sep 21, 2016 #7 Roberto P. said: Because I need to to call the static function of the form of several parts Click to expand... Create the class, then a Public object of type YourClass (a good place is the Starter service) and you can call its methods from all other modules, as if it were a code module (Starter.YourObject.MethodOne(param1,...)) Last edited: Sep 21, 2016 Upvote 0
Roberto P. said: Because I need to to call the static function of the form of several parts Click to expand... Create the class, then a Public object of type YourClass (a good place is the Starter service) and you can call its methods from all other modules, as if it were a code module (Starter.YourObject.MethodOne(param1,...))
Roberto P. Well-Known Member Licensed User Longtime User Sep 21, 2016 #8 thank you is what I did (but I wanted to avoid) Upvote 0
LucaMs Expert Licensed User Longtime User Sep 21, 2016 #9 Roberto P. said: but I wanted to avoid Click to expand... 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. said: but I wanted to avoid Click to expand... 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
Roberto P. Well-Known Member Licensed User Longtime User Sep 22, 2016 #10 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
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