SetTimeout: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
   
   
Function nextAction()
Function nextAction()
   Msgbox "nextAction"
   MsgBox "nextAction"
End Function
End Function
</pre>
</pre>
Line 25: Line 25:


<pre>
<pre>
 
(nextAction appears 3 seconds later)
 
 
nextAction appears 3 seconds later
</pre>
</pre>



Revision as of 19:31, 28 August 2012

SetTimeout (function, milliseconds)

ClearTimeout (settimeout_variable)

SetInterval (function, milliseconds)

ClearInterval(settimeout_variable)

Description

SetTimeOut is used to schedule an event for a future time, where function is the name of the Sub or Function to be called, and milliseconds is how long in the future it is to be called. Execution does not halt at this statement – it continues with the next statement. It returns a reference to the timeout action which can be used in ClearTimeOut.

Example

Rem SetTimeout statement
T=SetTimeout(nextAction,3000)
 
Function nextAction()
  MsgBox "nextAction"
End Function

Output

(nextAction appears 3 seconds later)

Related Items

ClearInterval, ClearTimeOut, SetInterval