I suppose, we need a function kinda "IsWindowTimer", that checks whether timer still alive.
Just like "IsThread"
Oh my god, I found duplicate 2010-year thread.
Does window timer still exist?
-
- Enthusiast
- Posts: 200
- Joined: Wed Feb 01, 2012 5:30 pm
- Location: Russian Federation
Does window timer still exist?
Former user of pirated PB.
Now registered user :].
Now registered user :].
Re: Does window timer still exist?
Threads can be stopped many many ways so IsThread is useful. However a window timer created with AddWindowTimer will run until you cancel it with RemoveWindowTimer (or I assume CloseWindow) so you should be able to track it quite easily?
-
- Enthusiast
- Posts: 200
- Joined: Wed Feb 01, 2012 5:30 pm
- Location: Russian Federation
Re: Does window timer still exist?
HOW?track it quite easily
When I cancelled timer, how then I can check, is it running or not?
Former user of pirated PB.
Now registered user :].
Now registered user :].
Re: Does window timer still exist?
Maybe:Korolev Michael wrote:HOW?track it quite easily
When I cancelled timer, how then I can check, is it running or not?
Code: Select all
Global NewMap timers()
Procedure _AddWindowTimer(window, timer, timeout)
timers(Str(window) + "_" + Str(timer)) = timeout ;signal timer present
AddWindowTimer(window, timer, timeout)
EndProcedure
Procedure _RemoveWindowTimer(window, timer)
If FindMapElement(timers(), Str(window) + "_" + Str(timer))
RemoveWindowTimer(window, timer)
DeleteMapElement(timers())
EndIf
EndProcedure
Procedure IsWindowTimer(window, timer)
ProcedureReturn Bool(FindMapElement(timers(), Str(window) + "_" + Str(timer)) <> 0)
EndProcedure
Procedure GetWindowTimerTimeout(window, timer)
If FindMapElement(timers(), Str(window) + "_" + Str(timer))
ProcedureReturn timers()
Else
ProcedureReturn 0
EndIf
EndProcedure
Macro AddWindowTimer(window, timer, timeout)
_AddWindowTimer(window, timer, timeout)
EndMacro
Macro RemoveWindowTimer(window, timer)
_RemoveWindowTimer(window, timer)
EndMacro
Macro ChangeWindowTimerTimeout(window, timer, newTimeout)
_RemoveWindowTimer(window, timer)
_AddWindowTimer(window, timer, newTimeout)
EndMacro
-
- Enthusiast
- Posts: 200
- Joined: Wed Feb 01, 2012 5:30 pm
- Location: Russian Federation
Re: Does window timer still exist?
Thanks, that's good solution.
Didn't think about overloading.
Didn't think about overloading.
Former user of pirated PB.
Now registered user :].
Now registered user :].