1. Win32Lib: how handle multiple Timers?

Dave,

 How do you use multiple timers?  I can see how to set up more than one, &
how to kill individual ones, but I can't see how to make individual
routines to respond to each separate timer, with just one onTimer event.
(Sorry if I'm missing something obvious.)

Thanks,
Dan

new topic     » topic index » view message » categorize

2. Re: Win32Lib: how handle multiple Timers?

Dan Moyer wondered:

> I can't see how to make individual routines to respond
>to each separate timer, with just one onTimer event.

The onTimer trap passes back the id of the timer that was triggered. For
example:

   -- set up some ids
   constant
      Timer1 = 1,
      Timer2 = 2,
      Timer3 = 3

   MyWindow_Timer( integer id )
      if id = Timer1 then
         -- timer 1 code
      elsif id = Timer2 then
         -- timer 2 code
      elsif id = Timer3 then
         -- timer3 code
      end if
   end procedure
   onTimer[MyWindow] = routine_id("MyWindow_Timer")

Did that answer the question?

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib: how handle multiple Timers?

Dave,

Yep!  Thanks, I was afraid it was obvious when I posted!

Dan


On Sun, 26 Sep 1999 12:36:27 -0700, David Cuny <dcuny at LANSET.COM> wrote:

>Dan Moyer wondered:
>
>> I can't see how to make individual routines to respond
>>to each separate timer, with just one onTimer event.
>
>The onTimer trap passes back the id of the timer that was triggered. For
>example:
>
>   -- set up some ids
>   constant
>      Timer1 = 1,
>      Timer2 = 2,
>      Timer3 = 3
>
>   MyWindow_Timer( integer id )
>      if id = Timer1 then
>         -- timer 1 code
>      elsif id = Timer2 then
>         -- timer 2 code
>      elsif id = Timer3 then
>         -- timer3 code
>      end if
>   end procedure
>   onTimer[MyWindow] = routine_id("MyWindow_Timer")
>
>Did that answer the question?
>
>-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu