The Clock


Also see Playing with Colors for an example of using the Timer in formatting the screen


The Basics

The Source Code:https://sites.google.com/site/blocks123/theclock/Clock_Date.zip



Timer

Working with the Timer I find that the TimerInterval is from the time you exit the .Timer procedure until it restarts, ie if TimerInterval is 1000ms (1 second) and it takes 45ms for the phone to do your blocks the total time between any one block will be 1045ms.

Setting .TimerEnabled to False (turning off the timer) will stop the next .Timer procedure for happening but doesn't reset the timer to zero, and setting .TimerEnabled to True (turning on the timer) doesn't reset the timer to zero either.  So if you turn off a 5000ms timer after 1000ms and restart it after another 1000ms the .Timer procedure will start in 3000ms, not 5000ms. (this is a reported bug).

Remember that your App is not the only thing running on the phone. If it's time for your Timer to go off and the phone is busy doing something else, your event will be delayed until the phone can get to it. This is shown by downloading TimerCheck to your phone and with .TimerAlwaysFires set to True start a second program and then come back to TimerCheck and you will see delays in the timestamps.

Here's the test App the shows this is true:TimerCheck.zip





*GOOGLE and Google App Inventor is a trademark of Google Inc.   All screenshots of 'Google App Inventor' are used in accordance with Google Inc Permission guidelines.
Blocks123.net and other content of this site is Copyright 2010 Edward Filkins. All Rights Reserved
ċ
Edward Filkins,
Oct 3, 2010, 4:50 AM
ċ
Edward Filkins,
Dec 11, 2010, 5:19 AM
Comments