Not sure if this has been asked already = could not find in the threads.
When creating a B4XLib for B4R, the lib contains one or more modules.
These modules can be used directly without declaring an object but the module can only be used for a single instance and not for multiple objects.
Example using a module named LEDControl, to control a single LED, in Main, i.e. LEDControl.Initialize(Pin_Nr As Byte) , LED.SetState(State As Boolean).
Wish
Declare a module as a class, to be able to declare multiple objects. The class to be used in a B4XLib like a CPP library.
Basically although came across for a B4XLib, this is not bound to a B4XLib but in general.
Example using the module with class LEDControl
Declare in Main:
The Class LEDControl to be defined like in B4J, i.e.
Sub Class_Globals
Public Sub Initialize
When creating a B4XLib for B4R, the lib contains one or more modules.
These modules can be used directly without declaring an object but the module can only be used for a single instance and not for multiple objects.
Example using a module named LEDControl, to control a single LED, in Main, i.e. LEDControl.Initialize(Pin_Nr As Byte) , LED.SetState(State As Boolean).
Wish
Declare a module as a class, to be able to declare multiple objects. The class to be used in a B4XLib like a CPP library.
Basically although came across for a B4XLib, this is not bound to a B4XLib but in general.
Example using the module with class LEDControl
Declare in Main:
B4X:
Private LED_Red As LEDControl
Private LED_Green As LEDControl
LED_Red.Initialize(13)
LED_Green.Initialize(12)
The Class LEDControl to be defined like in B4J, i.e.
Sub Class_Globals
Public Sub Initialize