neoHOW5: Count up/down display of time in HH:MM:SS


If your NeoBook application needs to display a count up (or down) of time elapsed (or remaining) ... in hours, minutes and seconds ... formated as HH:MM:SS ... the idea/subroutine described below will help you to do this.

First, create a Timer object called tc ... configure it so ...

  • Start: is set to Wait for "TimerStart" action
  • Variable: (to store elapsed time) is set to [tcElapsed]

... and its Timer Interval section contains ...



Then, create a Text object called TimeCounterDisplay to display the time counter ... define its content as ...



Case 1: Count Up

Insert this set of commands where you want the counter to be initiated ...



In this case, the count up will begin at 0:00:05 ... refresh every 2 seconds ... and if not forced earlier, stop at 2:00:00 ... and will trigger an external subroutine called gkAllDone when terminated.

If your applications need to invoke this facility frequently, you could create a NeoBook function like ...



And here is the code for the (optional) gkAllDone subroutine that you would place in the SubRoutines section of your publication ...



That is all.

If your application requires that the display count be prematurely terminated, all you need is a command like ...



Case 2: Count Down

Insert this set of commands where you want the counter to be initiated ...



In this case, the count down will begin at 1:01:15 ... refresh every 1 second ... and if not forced earlier, stop at 0:00:01 ... and will not trigger any external subroutine when terminated.

Back