JR,
You are right that the LD version takes a little longer to get going - not quite sure why this is, but there is more code due to potentially several timers.
A continuous loop isn't needed, since SB stays running when TextWindow is open, so the following also work.
or
Each timer does use its own thread. The following code trys to show how the different timers can be used.
Just saw last post by WHTurner and for the reasons above this also works.
You are right that the LD version takes a little longer to get going - not quite sure why this is, but there is more code due to potentially several timers.
A continuous loop isn't needed, since SB stays running when TextWindow is open, so the following also work.
Code:
Name=LDTimer.Add()
LDTimer.Interval(Name,10)
LDTimer.Tick=OnTimerTick
Program.Delay(100)
Sub OnTimerTick
TextWindow.WriteLine("Here")
EndSub
or
Code:
Name=LDTimer.Add()
LDTimer.Interval(Name,10)
LDTimer.Tick=OnTimerTick
TextWindow.WriteLine("Start")
Sub OnTimerTick
TextWindow.WriteLine("Here")
EndSub
Each timer does use its own thread. The following code trys to show how the different timers can be used.
Code:
'Original timer
Timer.interval= 1000
Timer.tick=OnTimerTick1
'2 Timers sharing an event subroutine
LDTimer.Tick=OnTimerTick2
Name1=LDTimer.Add()
LDTimer.Interval(Name1,500)
Name2=LDTimer.Add()
LDTimer.Interval(Name2,600)
'2 Timers on different event subroutines
Name3=LDTimer.Addtick("OnTimerTick3")
LDTimer.Interval(Name3,700)
Name4=LDTimer.Addtick("OnTimerTick4")
LDTimer.Interval(Name4,800)
Sub OnTimerTick1
TextWindow.WriteLine("SB Timer1")
EndSub
'2 timers sharing subroutine, distinguished by LastTimer
Sub OnTimerTick2
timer = LDTimer.LastTimer
TextWindow.WriteLine("LD Timer2 "+timer)
EndSub
'Since these timers are on different subroutines they don't set LastTimer
Sub OnTimerTick3
TextWindow.WriteLine("LD Timer3")
EndSub
Sub OnTimerTick4
TextWindow.WriteLine("LD Timer4")
EndSub
Just saw last post by WHTurner and for the reasons above this also works.
Code:
Name=LDTimer.Add()
LDTimer.Interval(Name,5000)
LDTimer.Tick=OnTimerTick
TextWindow.WriteLine("Start")
Sub OnTimerTick
TextWindow.WriteLine("Here")
EndSub