Re: Question on onTimer in Win32lib

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu