Hi,
It is known that CallSub does not work in Activity_Create (because the process is paused).
It does however seem to work if called indirectly in a class.
I have a StateManagerClass which is used by other classes and code.
In the MeterManagerClass
In StateManagerClass
screenManager users the StateManagerClass directly - the CallSub3 in EventRun does not execute.
meterManager uses the MeterManagerClass which uses StateManagerClass - the CallSub3 does execute
This seems a little inconsistent, is it Safe to do this?
P.S. I know if EventRun uses CallSubDelayed always works, but it does complicate the create timing in my application.
It is known that CallSub does not work in Activity_Create (because the process is paused).
It does however seem to work if called indirectly in a class.
I have a StateManagerClass which is used by other classes and code.
B4X:
'These are in Main
Sub Process_Globals
Public screenManager As StateManagerClass
Public meterManager As MeterManagerClass
...
Sub Activity_Create 'Main
If FirstTime Then
screenManager.Initialize("ScreenManager",Me,"ScreenManagerStateMachineCode")
screenManager.EventRun(GlobalEventNames.EVT_INITIAL_EVENT_RUN,Null) ' doesnt run
meterManager.Initialize()
End If
In the MeterManagerClass
B4X:
Sub Class_Globals
Private manager As StateManagerClass
...
Public Sub Initialize
manager.Initialize("MeterManager",Me,"StateMachineCode")
manager.EventRun(GlobalEventNames.EVT_INITIAL_EVENT_RUN, Null) 'does run
End Sub
In StateManagerClass
B4X:
Public Sub EventRun(event As Int, data As Object)
CallSub3(Module, StateCode, event, data)
End Sub
screenManager users the StateManagerClass directly - the CallSub3 in EventRun does not execute.
meterManager uses the MeterManagerClass which uses StateManagerClass - the CallSub3 does execute
This seems a little inconsistent, is it Safe to do this?
P.S. I know if EventRun uses CallSubDelayed always works, but it does complicate the create timing in my application.