Re: David Cuny Window question regarding onTimer

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

You can run multiple timers in a window, but they all go to the same 
routine.

eg:

procedure onTime_win(integer event, integer id, sequence params)
   if params[1] = 1 then
      --Code for timer event 1
   elsif params[1] = 2 then
      --Code for timer event 2
   end if
end procedure
setHandler(win, w32HTime, routine_id("onTime_win")
setTimer(win, 1, 1000) --once every second
setTimer(win, 2, 200) --5 times per second

Hope that helps...





>From: Michelle Rogers <michellerogers at bellsouth.net>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: David Cuny Window question regarding onTimer
>Date: Fri, 27 Feb 2004 19:56:33 -0500
>
>
>I have a question in regard to this topic..
>
>I tried once to attach two different timers to a single window and only one
>timer would work.  Did I do something wrong?  Or, is that a limit? (only 
>one
>timer attached to each window)   At the time, I created a second "dummy"
>window to run the second timer.
>
>Michelle
>Michelle Rogers
>----- Original Message -----
>From: "Derek Parnell" <ddparnell at bigpond.com>
>To: <EUforum at topica.com>
>Sent: Friday, February 27, 2004 4:50 PM
>Subject: Re: David Cuny Window question regarding onTimer
>
>
> > ----- Original Message -----
> > From: "Sixs" <sixs at ida.net>
> > To: <EUforum at topica.com>
> > Sent: Friday, February 27, 2004 5:31 PM
> > Subject: David Cuny Window question regarding onTimer
> >
> >
> > > Hello,
> > >
> > > I was looking at your bounce program in an email. I am wondering what
> > > activates the program in a windows program?
> >
> > A Windows program is a collection of small rouines that run when the
>events they are associated with occur. You can think of it like these
>routines are just sitting around waiting for their call up. Then they do
>their litle thing and go back to waiting again.
> >
> > You associate a routine with an event by using the setHandler() call. 
>This
>call links a routine, a type of event, and a control that the event happens
>to.
> >
> > > I thought that the program had to be run either by buttons, menus, or
> > > statements.
> >
> > Event though a Windows program may have these things, they don't CAUSE
>anything unless they have routines linked to their events. For example...
> >
> > Let's say I have a button called MyButton. I could then do something 
>like
>...
> >
> >   procedure Click_MyButton(integer self, integer event, sequence parms)
> >      -- The user pressed the button.
> >      . . .
> >   end procedure
> >
> >   -- Now link the button, event and routine together.
> >   setHandler(MyButton, w32HClick, routine_id("Click_MyButton"))
> >
> >
> > > What does this statement do? It seems to keep running over and over. I
> > > looked at the win documentation and didn't see the explanation.
> > >
> > > onTimer[Win] = routine_id("Tick")
> >
> > This is the old way of linking events to routines. In the newer 
>Win32lib,
>this has been replaced with ...
> >
> >   setHandler(Win, w32HTimer, routine_id("Tick"))
> >
> > But either way, this statement is a linking one. All it is saying that
>whenever a timer event fires for the Win control, run the routine called
>'Tick'.
> >
> > > Is this sort of a loop ?
> >
> > Not in itself. You need at least oe other statement to start the timer
>events happening. Something like this ...
> >
> >   setTimer(Win, 1, 5000)
> >
> > which is saying that I want Timer #1 to be attached to the Win control 
>and
>for it to fire off every 5000 milliseconds (5 seconds). With both this and
>the setHandler() call, the program will then run the 'Tick' routine every 5
>seconds.
> >
> > --
> > Derek
> >
> >
<snip>

>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu