Usina BRAdvPL Guide
Sign in
← All topics
COMMANDUnder review

DEFINE TIMER

DEFINE TIMER oTimer INTERVAL nInterval ACTION uAction

Defines a periodic interface action.

DEFINE TIMERAdvPL
01 · OVERVIEW

Overview

Historical DEFINE TIMER in RWMAKE2.CH expands INTERVAL and ACTION into TTimer():New; ACTIVATE TIMER is separate. That community 2012 include establishes its own expansion rather than universal availability in current includes. TTimer documentation confirms milliseconds and interface ownership. This example only defines an inactive timer; it demonstrates neither JOB execution nor clock precision. Real use requires owner and shutdown deactivation checks. (EURAI, 2012, ref. 1; TOTVS, n.d., ref. 2)

02 · SYNTAX

Syntax

DEFINE TIMER oTimer INTERVAL nInterval ACTION uAction

Parameters

oTimer
ObjectRequired

Variable receiving the timer.

nInterval
NumericRequired

Interval in milliseconds.

uAction
Code blockRequired

Action expression wrapped by the command.

Return value

Command without a function return.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"
User Function Ed348()
    Local oTimer
    // Definition only: no activation in this example.
    DEFINE TIMER oTimer INTERVAL 2000 ACTION ConOut("Test tick")
Return Nil
Expected result

Timer defined without ticks; the macro must exist in the environment include. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check include, lifecycle and SmartClient compatibility.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. EURAI. RWMAKE2.CH, ANALISE 2012.10.05. Definição de macro histórica analisada; não é aplicação completa. Accessed on 2026-10-26.
  2. TOTVS. TTimer. TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha