Timer stop when window loses focus

I’ve just discovered that a timer on a window will stop when that window loses focus.
I don’t see any properties that will keep the timer running under all circumstances.
Oddly, my main window has a timer, and it keeps running when I select the problem window. But the problem window timer stops when I select the main window.
Maybe a property of the window needs to be set?

Can anyone provide more insight into the behaviour?
TIA

[quote=165573:@Tom Dowad]I’ve just discovered that a timer on a window will stop when that window loses focus.
I don’t see any properties that will keep the timer running under all circumstances.
Oddly, my main window has a timer, and it keeps running when I select the problem window. But the problem window timer stops when I select the main window.
Maybe a property of the window needs to be set?[/quote]

On a window, the timer has a scope limited to that window.

  • Drag a timer in the navigator, but not on a window
  • Add to App a property T as timer (or any other name)
  • In the App open, place

T = new CustomTimer T.Period = 1000 //Whatever you want t.Mode = Timer.Mode.Multiple // Whatever you want

Now the timer will run all the time. You can modify it and stop it from anywhere as App.T.

Alternatively, you can make T a global Module property, but the principle remains the same.

Thanks Michel. That is essential knowledge for any animate application with multiple windows!

I presume I need to also use AddHandler to specify the Action handler for the timer

Not necessarily. You can attach the Action event to the CustomTimer you have dragged into the navigator.

[quote=165573:@Tom Dowad]I’ve just discovered that a timer on a window will stop when that window loses focus.
[/quote]
Just set its properties so it performs its action multiple times and whatever the period you want/need depending on usage
Nothing else required

What is the frame type of the window? That could have a bearing on the issue.