Erel B4X founder Staff member Licensed User Longtime User Monday at 12:29 PM #1 Code: Copy #if Module(B4XPages) 'a module named B4XPages exists #End If
Alessandro71 Well-Known Member Licensed User Longtime User Tuesday at 7:20 AM #2 does it applies to all .bas file? i.e. #if Module(name) where name can be either a Class or a Code Module or a Service/Receiver? what about b4xlibs or other libraries?
does it applies to all .bas file? i.e. #if Module(name) where name can be either a Class or a Code Module or a Service/Receiver? what about b4xlibs or other libraries?
LucaMs Expert Licensed User Longtime User Tuesday at 7:26 AM #3 Alessandro71 said: does it applies to all .bas file? i.e. #if Module(name) where name can be either a Class or a Code Module or a Service/Receiver? what about b4xlibs or other libraries? Click to expand... See this: #if Module(B4XPages) B4XPages is not a class or code module. I think it’s just a keyword used to determine whether the project is of the B4XPages type or not.
Alessandro71 said: does it applies to all .bas file? i.e. #if Module(name) where name can be either a Class or a Code Module or a Service/Receiver? what about b4xlibs or other libraries? Click to expand... See this: #if Module(B4XPages) B4XPages is not a class or code module. I think it’s just a keyword used to determine whether the project is of the B4XPages type or not.
aeric Expert Licensed User Longtime User Tuesday at 9:29 AM #4 In B4X, a module is refer to Code Module and Class Module. B4XLibs contains one or more of modules.
Erel B4X founder Staff member Licensed User Longtime User Tuesday at 9:46 AM #5 Alessandro71 said: does it applies to all .bas file? Click to expand... Yes, including code modules coming from other b4xlibs. aeric said: In B4X, a module is refer to Code Module and Class Module. Click to expand... True.
Alessandro71 said: does it applies to all .bas file? Click to expand... Yes, including code modules coming from other b4xlibs. aeric said: In B4X, a module is refer to Code Module and Class Module. Click to expand... True.
LucaMs Expert Licensed User Longtime User Tuesday at 2:34 PM #6 LucaMs said: B4XPages is not a class or code module. Click to expand... My mistake: I focused on the *type* of B4XPages projects, failing to realize that the `B4XPages` class itself exists! Use cases?
LucaMs said: B4XPages is not a class or code module. Click to expand... My mistake: I focused on the *type* of B4XPages projects, failing to realize that the `B4XPages` class itself exists! Use cases?
AnandGupta Expert Licensed User Longtime User Tuesday at 3:00 PM #7 Is it to find if a class is used in a b4xlib / 3rd party lib ?
Cableguy Expert Licensed User Longtime User Tuesday at 5:37 PM #8 If this could "read" from a file, we could have an "include" mimic
Erel B4X founder Staff member Licensed User Longtime User Wednesday at 6:02 AM #9 This is not an "include" feature. The use cases are mainly for libraries and other shared code. With this feature you can for example include different code based on the project type - whether it is a B4XPages project or not. SimpleMediaManager is another example that can benefit from such feature. Instead of requiring the developer to add conditional symbols (e.g. SMM_VIDEO), the code can check if the required module is available. Not all cases are covered yet but it is a step in the direction. Another use case - you created a useful module that you want to reuse in multiple projects. You can use this feature to customize it for a specific project without breaking: Code: Copy #If Module(SomeClassSpecificToProject8) Do something relevant to this project only, that won't compile in other projects #End If
This is not an "include" feature. The use cases are mainly for libraries and other shared code. With this feature you can for example include different code based on the project type - whether it is a B4XPages project or not. SimpleMediaManager is another example that can benefit from such feature. Instead of requiring the developer to add conditional symbols (e.g. SMM_VIDEO), the code can check if the required module is available. Not all cases are covered yet but it is a step in the direction. Another use case - you created a useful module that you want to reuse in multiple projects. You can use this feature to customize it for a specific project without breaking: Code: Copy #If Module(SomeClassSpecificToProject8) Do something relevant to this project only, that won't compile in other projects #End If