setTimeOut&cancleTimeOut

使用SetTimeOut方法可以设定指定方法的定时执行。只需提供要调用的方法名及以毫秒为单位的时间间隔。时间间隔可以通过两种方式测量:如果最后一个参数(idle)为TRUE,则从最后一次键盘或鼠标操作开始计时;若idle参数为FALSE,则从SetTimeOut调用开始计时,不考虑键盘操作。

Object.setTimeOut

Run on: Called
Description

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: Called
Description

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";
}
See Also
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值