Delaying method calls


Using the settimeout method on forms.


The element on a form has a settimeout method.

element.setTimeOut(str _method, int _waittime [boolean _idle = true])

The _method parameter specifies which method to call.
The _waitime parameter specifies the period of time in milliseconds before the method is called.
The _idle paramter specifies if the time should start right away (false) or if the time should start when Axapta is done executing. (true)


This is the only way to delay a method call in version 2.5.


Using the InfoLog class


The InfoLog has two method calls:

int addTimeOut(
object object,
str methodName,
int time,
boolean idle = true)

The object method specifies which object to call a method on.
The method parameter specifies which method to call.
The waitime parameter specifies the period of time in milliseconds before the method is called.
The idle paramter specifies if the timer should start right away (false) or if the timer should start when Axapta is done executing. (true)


The return value is a handle to the timer, which can be used to cancel the time out:

void removeTimeOut(int timerHdl)

Note: If your object gets out of scope before the delayed call is executed, the object will be collected by the garbage collector, and the method will not be called.


Three-Tier considerations


The method is implemented on the infolog class, because only the client side has access to the timer functions.

Comments (0)

Skip to main content