B4A Class [B4X] CallSubPlus - CallSub with explicit delay


Licensed User
I had the "If rdd.Delayed Then" in tmr_Tick give an error. Checked this sub and found it wasn't Initialized
Private Sub PlusImpl(Module As Object, SubName As String, Delay As Int, Arg() As Object, delayed As Boolean)
    If RunDelayed.IsInitialized = False Then RunDelayed.Initialize
    Dim tmr As Timer
    tmr.Initialize("tmr", Delay)
    Dim rdd As RunDelayedData
    rdd.Initialize ' added 2/18/2018 not initialized
    rdd.Module = Module
    rdd.SubName = SubName
    rdd.Arg = Arg
    rdd.delayed = delayed
    RunDelayed.Put(tmr, rdd)
    tmr.Enabled = True
End Sub
Last edited:


Staff member
Licensed User
You should post the error you got. It is most probably not related to the type initialization.

Note that there is no reason to use CallSubPlus now that Sleep is available. Just call Sleep and then call whichever sub you like.