Enabled Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use this property to activate or deactivate the timer. If the timer is inactive, the timer routine is not called.

Declaration

TimerObj.Enabled

Read-Write Property Boolean
TimerObj An expression, variable or parameter that specifies a reference to a Timer object

Applies To

The property is applied to the following object:

Property Value

A boolean value that specifies whether the timer is active.

Remarks

The initial state of the timer is determined by the Enabled parameter of the Timers.Add function that creates timers. So, you can initially disable the timer and activate it with the Enabled property when necessary.

Example

The following code creates a disabled timer and then activates it using the Enabled property.

JavaScript, JScript

MyTimer = Utils.Timers.Add(10000, "MainUnit.TimerProcedure", false);
// ...
MyTimer.Enabled = true;

Python

MyTimer = Utils.Timers.Add(10000, "MainUnit.TimerProcedure", False)
# ...
MyTimer.Enabled = True

VBScript

Set MyTimer = Utils.Timers.Add(10000, "MainUnit.TimerProcedure", False)
' ...
MyTimer.Enabled = True

DelphiScript

var MyTimer;
begin
  MyTimer := Utils.Timers.Add(10000, 'MainUnit.TimerProcedure', false);
  // ...
  MyTimer.Enabled := true;
end;

C++Script, C#Script

var MyTimer;
MyTimer = Utils["Timers"]["Add"](10000, "MainUnit.TimerProcedure", false);
// ...
MyTimer["Enabled"] = true;

See Also

Using Timers
Add Method
Interval Property
TimerProc Property

Highlight search results