UpDown Acceleration Information

Applies to TestComplete 14.71, last modified on April 22, 2021

If you hold the up or down arrow button of the UpDown control for some time, the displayed value will increase (or decrease) with a bigger step. You can verify the rate of the value change when the arrow button is held for some time.

While testing UpDown controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

To get information about the acceleration parameters, use the wAcceleration property of the Win32UpDown object. TestComplete associates this object with all UpDown controls whose class names are listed in the project’s Object Mapping options.

The UpDown control can have several degrees of acceleration or it can have no such degrees at all. The rate of the value change depends on the period of time during which you are holding the control's arrow button. To learn how many acceleration information items the UpDown control has, use the wAccelerationCount property of the Win32UpDown object.

The wAcceleration property has one parameter that specifies the index of the acceleration information item. This property returns the Win32AccelerationInfo object that is a helper object of the Win32UpDown object and contains the acceleration parameters. You can get the acceleration parameters using the wIncrement and wTime properties of the Win32AccelerationInfo object.

Below is an example that demonstrates how you can get the number of acceleration information items and get information about the acceleration parameters:

JavaScript, JScript

function main()
{
  var UpDown, AccelerationInfo;
    
  // Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1);
  
  // Get the number of the acceleration information items
  Log.Message (UpDown.wAccelerationCount);
  
  // Obtain the Win32AccelerationInfo object that provides information about the acceleration parameters
  AccelerationInfo = UpDown.wAcceleration(0)
  
  // Get the acceleration parameters
  Log.Message (AccelerationInfo.wIncrement);
  Log.Message (AccelerationInfo.wTime);
}

Python

def Main():
    
  # Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1)
  
  # Get the number of the acceleration information items
  Log.Message (UpDown.wAccelerationCount)
  
  # Obtain the Win32AccelerationInfo object that provides information about the acceleration parameters 
  AccelerationInfo = UpDown.wAcceleration[0]
  
  # Get the acceleration parameters
  Log.Message (AccelerationInfo.wIncrement)
  Log.Message (AccelerationInfo.wTime)

VBScript

Sub main
  Dim UpDown, AccelerationInfo
    
  ' Obtain the UpDown control
  Set UpDown = Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1)

  ' Get the number of the acceleration information items
  Log.Message UpDown.wAccelerationCount
  
  ' Obtain the Win32AccelerationInfo object that provides information about the acceleration parameters
  Set AccelerationInfo = UpDown.wAcceleration(0)
  
  ' Get the acceleration parameters
  Log.Message AccelerationInfo.wIncrement
  Log.Message AccelerationInfo.wTime
End Sub

DelphiScript

procedure main;
var UpDown, AccelerationInfo;
begin

  // Obtain the UpDown control
  UpDown := Sys.Process('Project1').Window('TForm1', 'Form1', 1).Window('TUpDown', '', 1);
  
  // Get the number of the acceleration information items
  Log.Message (UpDown.wAccelerationCount);
  
  // Obtain the Win32AccelerationInfo object that provides information about the acceleration parameters
  AccelerationInfo := UpDown.wAcceleration(0);
  
  // Get the acceleration parameters
  Log.Message (AccelerationInfo.wIncrement);
  Log.Message (AccelerationInfo.wTime);
end;

C++Script, C#Script

function main()
{
  var UpDown, AccelerationInfo;
    
  // Obtain the UpDown control
  UpDown = Sys["Process"]("Project1")["Window"]("TForm1", "Form1", 1)["Window"]("TUpDown", "", 1);
  
  // Get the number of the acceleration information items
  Log.Message(UpDown["wAccelerationCount"]);
  
  // Obtain the Win32AccelerationInfo object that provides information about the acceleration parameters
  AccelerationInfo = UpDown["wAcceleration"](0);
  
  // Get the acceleration parameters
  Log.Message (AccelerationInfo["wIncrement"]);
  Log.Message (AccelerationInfo["wTime"]);
}

See Also

Working With UpDown Controls
wAcceleration Property (UpDown Controls)
wAccelerationCount Property (UpDown Controls)
Win32AccelerationInfo Object
wIncrement Property
wTime Property

Highlight search results