Getting the UpDown Value

Applies to TestComplete 14.92, last modified on September 16, 2021

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 the integer value that is currently displayed in the UpDown control's associated control, use the wPosition property of the Win32UpDown object. TestComplete associates this object with all UpDown controls whose class names are listed in the Object Mapping options of your project.

The following example demonstrates how you can get the integer value that is currently displayed in the Edit Box control used with the UpDown control:

JavaScript, JScript

function main()
{
  var UpDown;
    
  // Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1);
    
  // Get the value that is currently displayed in the Edit control.
  Log.Message (UpDown.wPosition);
}

Python

def Main():
    
  # Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1)
    
  # Get the value that is currently displayed in the Edit control.
  Log.Message (UpDown.wPosition)

VBScript

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

  ' Get the value that is currently displayed in the Edit control.
  Log.Message UpDown.wPosition
End Sub

DelphiScript

procedure main;
var UpDown;
begin

  // Obtain the UpDown control
  UpDown := Sys.Process('Project1').Window('TForm1', 'Form1', 1).Window('TUpDown', '', 1);
    
  // Get the value that is currently displayed in the Edit control.
  Log.Message (UpDown.wPosition);
end;

C++Script, C#Script

function main()
{
  var UpDown;
    
  // Obtain the UpDown control
  UpDown = Sys["Process"]("Project1")["Window"]("TForm1", "Form1", 1)["Window"]("TUpDown", "", 1);

  // Get the value that is currently displayed in the Edit control.
  Log.Message(UpDown["wPosition"]);
}

See Also

Working With UpDown Controls
wPosition Property (UpDown Controls)

Highlight search results