Hi,
I try to segment my code between views and operational functions.
By example :
But sometime the class ScoreManager must have access to subs in the main code
Is it the only possibility to call a sub in the Main code ? Does a syntax exist which allow to call the sub directly ?
Thanks
I try to segment my code between views and operational functions.
By example :
B4X:
Main
Sub Globals
dim btn1, btn2 as Button
dim manager as ScoreManager
end sub
Sub Init
manager.Initialize
end sub
Sub btn1_click
manager.IncrementScore
end sub
Sub btn2_click
...
end sub
Class ScoreManager
Sub Class_Globals
Sub tim as Timer
end sub
Sub Initialize
...
End Sub
Sub IncrementScore
If tim.Enabled then
...
else
...
End if
End Sub
But sometime the class ScoreManager must have access to subs in the main code
B4X:
Class ScoreManager
Sub IncrementScore
If tim.Enabled then
CallSub(Main, "btn2_click")
else
...
End if
Is it the only possibility to call a sub in the Main code ? Does a syntax exist which allow to call the sub directly ?
Thanks