Oct 22, 2014 Replies: 4 There are two types of modules in B4i: static modules and classes. A class is a template. At runtime you can create any number of instances based on the class template. Each instance will have its own set of global variables (its state). You must call the class Initialize method before you call any other methods of the class. Note that you can change the Initialize sub signature as needed. Static modules can be considered singleton classes or a template with exactly one instance (with the same name). Unlike B4A (and like B4J) static modules can handle events. If you are converting a B4A project to B4i then B4A activities and services should be converted to static modules. Note that you don't need to use CallSub or CallSubDelayed to interact with subs in other modules. You can call them directly. The program structure is more flexible than in B4A as you don't need to create a new module for each Page. However that means that you need to pay more attention to your program architecture. Click to expand...
There are two types of modules in B4i: static modules and classes. A class is a template. At runtime you can create any number of instances based on the class template. Each instance will have its own set of global variables (its state). You must call the class Initialize method before you call any other methods of the class. Note that you can change the Initialize sub signature as needed. Static modules can be considered singleton classes or a template with exactly one instance (with the same name). Unlike B4A (and like B4J) static modules can handle events. If you are converting a B4A project to B4i then B4A activities and services should be converted to static modules. Note that you don't need to use CallSub or CallSubDelayed to interact with subs in other modules. You can call them directly. The program structure is more flexible than in B4A as you don't need to create a new module for each Page. However that means that you need to pay more attention to your program architecture.
F fishwolf Well-Known Member Licensed User Longtime User Dec 8, 2014 #2 if i want use a module for write the code for a specific section of project, can i do ? i have try to only create a new module and the app start with a blank page. for a big project is better divide the code in modules.
if i want use a module for write the code for a specific section of project, can i do ? i have try to only create a new module and the app start with a blank page. for a big project is better divide the code in modules.
Erel B4X founder Staff member Licensed User Longtime User Dec 9, 2014 #3 fishwolf said: if i want use a module for write the code for a specific section of project, can i do ? Click to expand... Yes.
fishwolf said: if i want use a module for write the code for a specific section of project, can i do ? Click to expand... Yes.
F fishwolf Well-Known Member Licensed User Longtime User Dec 9, 2014 #4 if i want use a module for write the code for a specific section of project, can i do ? i have try to only create a new module and the app start with a blank page. for a big project is better divide the code in modules. Erel said: Yes. Click to expand... Why if i add a new module (empty) the app stops working ? the same also if i add a exist module as httputil2. show a empty page
if i want use a module for write the code for a specific section of project, can i do ? i have try to only create a new module and the app start with a blank page. for a big project is better divide the code in modules. Erel said: Yes. Click to expand... Why if i add a new module (empty) the app stops working ? the same also if i add a exist module as httputil2. show a empty page
Erel B4X founder Staff member Licensed User Longtime User Dec 9, 2014 #5 Please start a new thread and upload the non-working project.