iOS Question Timer inside a Class

narek adonts

Well-Known Member
Licensed User
I didnt understood.
The following code is inside a Class

B4X:
Sub Class_Globals
    Dim tmrShow As Timer
   
End Sub


Public Sub Initialize(eventName As String, Inter As Int,color As Int,Receiver As Panel)
   
    tmrShow.Initialize("tmrShow",Inter)

    tmrShow.Enabled=True
    pnlReceiver=Receiver
    CircleColor=color
    EventStr=eventName
    cInterval=Inter
   
End Sub

Private Sub TmrShow_Tick
Log("tick")
End Sub
It doesnt work
 

stevel05

Expert
Licensed User
This works with a timer in a class, check your code against this one:
 

Attachments

stevel05

Expert
Licensed User
If you declare a reference to the class as a local variable, then it is likely that the class will be destroyed once the sub it's declared in is completed. You will need to hold a reference in a Global variable or a collection that is a Global variable (Array,List or Map) for the class instance to persist.
 
Top