1. Question on onTimer in Win32lib
- Posted by SR Williamson <sr.williamson at OSHA.GOV> Feb 17, 2000
- 493 views
Okay, I thought I understood how to do timers in Win32lib, but obviously I don't. How do you use multiple timers? It seems you can't, if you have to use the handle of the window as the parameter in the onTimer statement. For example onTimer[MainWin] = routine_id(doSomething) There isn't any documentation to speak of in the win32lib.ew on timers. So how do you use them? Sherm
2. Re: Question on onTimer in Win32lib
- Posted by Brian Broker <bkb at CNW.COM> Feb 17, 2000
- 534 views
On Thu, 17 Feb 2000 14:20:50 -0500, SR Williamson wrote: >Okay, I thought I understood how to do timers in Win32lib, but obviously I >don't. > >How do you use multiple timers? It seems you can't, if you have to use the >handle of the window as the parameter in the onTimer statement. For example >onTimer[MainWin] = routine_id(doSomething) > >There isn't any documentation to speak of in the win32lib.ew on timers. So >how do you use them? > >Sherm The onTimer routine gets passed an integer parameter which is the id of the Timer that is getting processed. So an example for two timers might look something like: constant Win = create( Window, ... ), Timer1 = 1, Timer2 = 2 setTimer( Win, Timer1, 1000 ) setTimer( Win, Timer2, 5000 ) procedure onTimer_Win( integer id ) if id = Timer1 then ... -- Do something every second elsif id = Timer2 then ... -- Do something else every 5 seconds endif end procedure onTimer[Win] = routine_id( "onTimer_Win" ) WinMain( Win, Normal ) -- Brian