Re: do pop up boxes stop all events?



On Sep 19, 3:46 pm, dpb <n...@xxxxxxx> wrote:
Jim Mack wrote:
dpb wrote:
The Timer will fire on a 100 Hz schedule, within the uncertainty of
Windows, but events may become "stacked up" if there is a bunch of
other activity as, say, from a user switching applications or using
a complex UI to update graphics or somesuch while data acq is going
on in the background.

It's a common misconception that Timer events 'stack up'. They don't.
Any Timer event that occurs while a prior event is being serviced is
lost, not deferred. Do as little as possible in the actual Timer event
to avoid lost ones.

While 100 Hz isn't that high, it's still usually better, if events are
critical, to use the Timer event to just set a flag or bump a counter
and exit. Meanwhile a tight loop with DoEvents does the actual work,
clearing the flag or decrementing the counter as it handles the tasks.

OK, been too long since I used VB for any critical servicing more than
the 1 Hz sorta' thing where would never be an issue -- was thinking it
did add to a queue, but didn't look it up -- thanks for fixing up after
me... :)

It's certainly ideal to keep the Timer routine short as possible. Just
depends on what is actually the level of activity required as to whether
might just go ahead and service the event from the Timer routine or not.
If only set the global or add to a queue, still the overall work has
to be only a fraction of the timer interval or will run into missing
events so the loss of system responsiveness to the UI is the other
performance issue.

(And I know you know that, just adding to hopefully OP's erudition...)

--- Hide quoted text -

- Show quoted text -

I have my app working with a timer in a third form that pushes data
out two the other two forms. Thanks for all the help!

From some experiments, I found that timers are not really reliable in
that a 10 ms interval timer does not try to maintain a 100 hertz
rate. I think it just gets requeued 10 ms after it runs, or something
like that.

You can show this in a simple test app

in Load:

cnt = Timer()*1000 'Number of milliseconds since mignight
Text1.Text = 0

And in the timer event:

cnt = cnt + Timer1.Interval
Text1.Text = clng (cnt - Timer()*1000)

Text1 will show an increasing negative value. You might have to
performance stress your box a little if its fast, and keep the timer
interval small.

Anyway it was easy to work around this for me.


.



Relevant Pages

  • Re: Flashing labels?
    ... A simple but not so nice code timer event you can try. ... Dim cnt As Integer ... The user should enter information into all of the enabled textboxes before ...
    (microsoft.public.access.formscoding)
  • Re: do pop up boxes stop all events?
    ... a 100 hertz rate. ... And in the timer event: ... cnt = cnt + Timer1.Interval ... If you want better resolution and consistent intervals you would be better off constructing a multimedia timer in code, or using one of the many hires multimedia timers that are available as freeware on various sites, including VBAccelerator. ...
    (microsoft.public.vb.general.discussion)
  • Re: do pop up boxes stop all events?
    ... a 100 hertz rate. ... And in the timer event: ... cnt = cnt + Timer1.Interval ... I suspect that it just reschedules with a 10 ...
    (microsoft.public.vb.general.discussion)
  • Re: Timer to copy files
    ... Randy Birch wrote: ... So change the If test in the timer to If cnt=60 rather than If cnt ... If accuracy is any concern at all, when the timer is enabled, the OP ...
    (microsoft.public.vb.controls)

Loading