No Action Event for Timer Class? (API 2.0)

Xojo.Core.Timer is Deprecated, and the API 2.0 Timer class looks to be supported in iOS target but not it’s Action event? (which is kind of a big one :smiley:)

Is the only recourse (for now) to use Xojo.Core.Timer for iOS builds?


Isn’t this for a WebTimer Greg?

Docs shows both

Not for Action event handler though…


(and the compiler doesn’t seem to recognize Action in iOS Builds in latest Xojo release.

Here I see:

Oh. Are you saying the class isn’t supported at all @Rick_A ?

This may be the case, though the compiler seems to be OK with creating an instance of Timer in an iOS project…

I’m just going to use Xojo.Core.Timer for now.

For iOS, use the Run() event, because there they say “for Mobile”


1 Like

And… this appears to be a Language Reference issue. The local Language Reference is not showing the Run event. @Paul_Lefebvre - something to look at maybe?

Timer.Run doesn’t seem to autocomplete either in iOS projects, fyi.

Thanks for the assistance @Rick_A and @Greg_O_Lone Looks like I’m all sorted now.

1 Like

One last followup to this to help fellow travelers on the Xojo road.

At least as of this writing, the “Run” Event is currently not supported on Desktop/Console/Web targets, so if you want to write code which uses timers and works on Desktop/Console you’ll need to do something like this:

self.MyTimer = new Timer
self.MyTimer.RunMode = timer.RunModes.Multiple
self.MyTimer.Period = 500

#if TargetIOS then
  AddHandler self.MyTimer.Run, AddressOf self.actionHandler

#else //handle other targets
  AddHandler self.MyTimer.Action, AddressOf self.actionHandler


This should let you have a single event handler for all targets. (at least until Xojo adds the “Run” Event to the Timer class for Desktop/Web/Console)

actionHandler would be declared like this in a class:

Sub actionHandler(t as Timer)
  //Do stuff here
End Sub