Hello guys,
I have this test program where I'm trying to reach a SUB by passing its name as arg of another an initial SUB (see example below).
I'm using callsub2. Documentation says I have to pass component name (which in my case is Main), but syntax checker says that Main is an undefined variable and, when I code "Main" instead, it ignores the routine to be called and does nothing.
Any clues on how to fix it?
Regards.
I have this test program where I'm trying to reach a SUB by passing its name as arg of another an initial SUB (see example below).
I'm using callsub2. Documentation says I have to pass component name (which in my case is Main), but syntax checker says that Main is an undefined variable and, when I code "Main" instead, it ignores the routine to be called and does nothing.
B4X:
Sub Activity_Create(FirstTime As Boolean)
rotina1("rotina2", "Teste1")
rotina1("rotina3", "Teste2")
End Sub
Sub rotina1(proc As String, parm As String)
Log ("rotina1 - parm: " & parm)
CallSub2(main, proc, parm ) ' <== NOT CALLING THE DESIRED SUB ROUTINE
End Sub
Sub rotina2(parm1 As String)
Log("rotina 2 - parm: " & parm1)
End Sub
Sub rotina3(parm1 As String)
Log("rotina 3 - parm: " & parm1)
End Sub
Any clues on how to fix it?
Regards.