Share via


Object.setTimeOut Method

Sets up the scheduled execution of a specified method.

Syntax

Note

The syntax of this method varies based on the version of Microsoft Dynamics AX that you are using.

  Microsoft Dynamics AX 2012 R3
          public int setTimeOut( 
                        str Method, 
                        int WaitTime, 
                        [boolean idle=true])

  Microsoft Dynamics AX 2012 Feature Pack (SYS)
          public int setTimeOut( 
                    str Method, 
                    int WaitTime, 
                    [boolean idle=true])

  Microsoft Dynamics AX 2012 (FPK)
          public int setTimeOut( 
                    str Method, 
                    int WaitTime, 
                    [boolean idle=true])

  Microsoft Dynamics AX 2012 (SYS)
          public int setTimeOut( 
                    str Method, 
                    int WaitTime, 
                    [boolean idle=true])

Run On

Called

Parameters

  • Method
    Type: str
    The name of the method to call.
  • WaitTime
    Type: int
    The time, in milliseconds, before the method is called.
  • idle
    Type: boolean
    true to measure the interval from when the keyboard or mouse was last used; false to measure the time from when the setTimeOut method is called; optional.

Return Value

Type: int
The timer handle to use if you have to cancel the timeout.

Remarks

The scheduled time out is automatically removed after the method has been called. If you want to cancel the execution of the method before the specified time has elapsed, you can do it by using the cancelTimeOut method.

Examples

The following example prints text to the Infolog after two seconds.

 
static void setTimeOutJob() 
{ 
    Object o = new Object(); 
 
    void printText() 
    { 
        info( "2 seconds has elapsed since the user did anything" ); 
    } 
 
    // Set a Time Out with the idle flag set to false 
    o.setTimeOut(identifierstr(printText), 2000, false); 
}

See Also

Object Class

Object.cancelTimeOut Method