Alpha Video Training
Results 1 to 5 of 5

Thread: Basic Form Timer

  1. #1
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,643

    Default Basic Form Timer

    Attached is a timer form. It's accurate because it's using system time, not a straight "countdown" method as I had tried originally. I tested it against my digital wrist watch using 10 minutes (600 seconds) and it matched exactly. Test it and see what you think. If you prefer, you can change the variable's display setting to show no decimal places - but the form's OnTimer setting is set to 0.1 seconds as is the code. Don't change those settings otherwise it may not be accurate. The countdown changes color at the 10 second & 5 second marks and the buzzer sounds at zero.

    There is also a timer_x form that just does a time display at 0, 0.0 and 0.00 places and a simple countdown - click the start button to countdown intelligibly. I just built it to prove the point that you can have accurate OnTimer event at 0.01 - but it depends upon how much junk code you add. Form UI methods can trip up a fast form counter since the screen draws may take longer that the count cycle, so the next cycle is already executing before the last one has finished (or barely started). It really depends upon what you are trying to get away with.

    Technically the timer might still work ok if you set the form's OnTimer event to 0.01 seconds - but if the variable's display is set to 2 decimal places the display it will "jump" over certain values in the 0.nn range. That's probably because the eye can't keep up with that rate of change or it may be because the OnTimer event does not correspond exactly to the value it is set to. But that doesn't effect the accuracy of the clock for the reasons described above.

    In short, my recommendation is to leave the variable display to 1 decimal place or no decimals.

    Note: I'm not an xdialog fan hence the form method. But no offense to you xdialog savants.

    Timer.zip
    Last edited by Peter.Greulich; 08-29-2013 at 05:59 PM.

  2. #2
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,951

    Default Re: Basic Form Timer

    Peter, can he install and run it on a hand held device?
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  3. #3
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,643

    Default Re: Basic Form Timer

    Martin, I PM'd you.

  4. #4
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,643

    Default Re: Basic Form Timer

    Just as a point of reference. Originally I coded the above timer to use the OnTimer event and do a countdown. In 600 seconds (10 minutes) Alpha was off by about 26 seconds. But using system time as described above, it's exact. Or, at least, it exactly matches your system time in terms of differential and countdown.

  5. #5
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,643

    Default Re: Basic Form Timer

    Attached is an updated timer form with a "restart" button. You will have to import it into the above dbf.

    Timer3_rev_8_30_13.a5pkg

Similar Threads

  1. Pause form timer interval
    By Ed Barley in forum Alpha Five Version 6
    Replies: 4
    Last Post: 08-04-2005, 01:47 PM
  2. Form Timer
    By Duane Pederson in forum Alpha Five Version 6
    Replies: 2
    Last Post: 03-29-2005, 09:05 AM
  3. Form On Timer
    By Ed Barley in forum Alpha Five Version 5
    Replies: 2
    Last Post: 12-06-2004, 10:42 AM
  4. form timer
    By Duane Pederson in forum Alpha Five Version 5
    Replies: 4
    Last Post: 06-22-2004, 08:04 AM
  5. Form Timer
    By Mike Konoff in forum Alpha Five Version 4
    Replies: 3
    Last Post: 08-24-2000, 05:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •