Object.setTimeOut
Run on: CalledDescription
Use the SetTimeOut method to setup timed execution of a specified method. You only need to specify the name of the method to call, and the time in milliseconds before the function should be called.
The interval can be measured i two ways:
If the last argument (idle) is TRUE (default), the interval is measured from when the keyboard or mouse was last used.
If the idle-argument is FALSE, the time is measured from the call of SetTimeOut, without regard to keyboard use.
The latter form should be used with care since time-intensive tasks activated while the user is using the machine can slow things down.
Syntax
public final int setTimeOut(str _Method, int _WaitTime [, boolean _idle] )
Arguments
- Method : Name of method to call.
- WaitTime : Time in milliseconds
- Idle : Set to TRUE if time should only be measured while the program is idle.
Returns
Int - Timer Handle to be used if you need to Cancel the Timeout.Remarks
The scheduled timeout is automatically removed after the method has been called. If you would like to cancel execution of the method before the specified time has elapsed, this can be done using the CancelTimeOut method.
See the sample form tutorial_timer that demonstrates both idle and non-idle timers. Try using the keyboard in the two edit-fields, and watch one of the clocks stop. This is the one controlled by an idle timer.
Example
int th;
th = this.SetTimeOut("TimedEvent",2000);
....
int TimedEvent()
{
print "2 seconds has elapsed since the user did anything";
}
Object.setTimeOut
Run on: CalledDescription
Use the SetTimeOut method to setup timed execution of a specified method. You only need to specify the name of the method to call, and the time in milliseconds before the function should be called.
The interval can be measured i two ways:
If the last argument (idle) is TRUE (default), the interval is measured from when the keyboard or mouse was last used.
If the idle-argument is FALSE, the time is measured from the call of SetTimeOut, without regard to keyboard use.
The latter form should be used with care since time-intensive tasks activated while the user is using the machine can slow things down.
Syntax
public final int setTimeOut(str _Method, int _WaitTime [, boolean _idle] )
Arguments
- Method : Name of method to call.
- WaitTime : Time in milliseconds
- Idle : Set to TRUE if time should only be measured while the program is idle.
Returns
Int - Timer Handle to be used if you need to Cancel the Timeout.Remarks
The scheduled timeout is automatically removed after the method has been called. If you would like to cancel execution of the method before the specified time has elapsed, this can be done using the CancelTimeOut method.
See the sample form tutorial_timer that demonstrates both idle and non-idle timers. Try using the keyboard in the two edit-fields, and watch one of the clocks stop. This is the one controlled by an idle timer.
Example
int th;
th = this.SetTimeOut("TimedEvent",2000);
....
int TimedEvent()
{
print "2 seconds has elapsed since the user did anything";
}
使用SetTimeOut方法可以设定指定方法的定时执行。只需提供要调用的方法名及以毫秒为单位的时间间隔。时间间隔可以通过两种方式测量:如果最后一个参数(idle)为TRUE,则从最后一次键盘或鼠标操作开始计时;若idle参数为FALSE,则从SetTimeOut调用开始计时,不考虑键盘操作。
1393

被折叠的 条评论
为什么被折叠?



