B4J Question Process_Global to share variable

G.Z.

Member
Hello,
I'm trying to play with the HelloWorld example and I need to share a variable from all module.
I wrote this
(in Main)
Sub Process_Globals
Public StartBus As Int = 0
End Sub
(in HelloWorld)
Sub btnCalc_Click (Params As Map)
StartBus = 1
End Sub
In the module HelloWorld I want to set StartBus = 1 to start a proces tha is running in Main (timer)
The problem is in the HelloWorld module the variable StartBus seem undeclared and setting it to 1 dont let start other process.
Any suggestion pls.?
Thanks
 

inakigarm

Well-Known Member
Licensed User
Longtime User
You've to reference the Module from you're declaring the variable (in this case, Main); so, in Module HelloWorld, set (or get) the variable with:

B4X:
Main.Startbus=1
 
Upvote 0
Top