IB Statements/SetTimer
From CometWiki
(Difference between revisions)
(added code example) |
m |
||
Line 21: | Line 21: | ||
SetTimer will fire from an Input statement, Wait statement, or EventWait statement. | SetTimer will fire from an Input statement, Wait statement, or EventWait statement. | ||
+ | |||
+ | To stop the timer, use the following: | ||
+ | SetTimer "", 0 | ||
</td> | </td> |
Revision as of 19:45, 22 July 2010
Introduction
There are many times that you may want to get some information from the user but there are records extracted, or some other reason that would mess things up if the user did not provide the information in a timely manor.
With the SetTimer statement, you can limit the time a user has to input the info, and take some action.
Syntax: |
SetTimer TimerName, Duration Where TimerName is a string expression and Duration is a numeric expression. |
Discussion: |
The SetTimer instruction causes an event to be fired to the program when a specified duration (in Milliseconds) has passed.In the event handler, the program has the opportunity to do several things.
SetTimer will fire from an Input statement, Wait statement, or EventWait statement. To stop the timer, use the following: SetTimer "", 0 |
Example: |
Length 254 & Local EventSource$, EventName$ length 80 & local a$ Length 5.0 & Local Count Clear Print (cs) EventSub TimerFunc EventSource$ EventName$ SetTimer "Timer 1: "+Term$, 10*10*10 ! One Second print @(0,9);'enter something' input @(1,10) a$ if a$ = "" goto DoEnd print @(0,10);(cfld);@(0,11);'you entered ';a$ Loop DoEnd: SetTimer "", 0 EventSub print @(0,15);'done' & wait Stop TimerFunc: Count = Count + 1 Print (mc);@(0,5);(rb);"Source: " ; EventSource$ ; " Event: " ; EventName$ ; "(";Count;")";(rc) EventSub TimerFunc EventSource$ EventName$ Return
|