Getting the Minimum and Maximum Allowed Values in UpDown Controls

Applies to TestComplete 14.10, last modified on June 5, 2019

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.

The value you set in the UpDown control's associated control must be within the range that is bounded by the minimum and maximum values.

To get the minimum and maximum values that can be assigned to the wPosition property, use the wMin and wMax properties 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 wMin and wMax properties return the minimum and maximum values that you can set using the UpDown control. By default, the minimum value is 0, the maximum is 100.

The following example demonstrates how you can get the minimum and maximum values:

JavaScript, JScript

function main()
{
  var UpDown;
    
  // Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1);
    
  // Get the minimum and maximum values
  Log.Message(UpDown.wMin);
  Log.Message(UpDown.wMax);
}

Python

def Main():
    
  # Obtain the UpDown control
  UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1)
    
  # Get the minimum and maximum values
  Log.Message(UpDown.wMin)
  Log.Message(UpDown.wMax)

VBScript

Sub main
  Dim UpDown
    
  ' Obtain the UpDown control
  Set UpDown= Sys.Process("Project1").Window("TForm1", "Form1", 1).Window("TUpDown", "", 1)
     
  ' Get the minimum and maximum values
  Log.Message UpDown.wMin
  Log.Message UpDown.wMax
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 minimum and maximum values
  Log.Message(UpDown.wMin);
  Log.Message(UpDown.wMax);
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 minimum and maximum values
  Log.Message(UpDown["wMin"]);
  Log.Message(UpDown["wMax"]);
}

See Also

Working With UpDown Controls
wPosition Property (UpDown Controls)
wMin Property (UpDown Conrtrols)
wMax Property (UpDown Controls)

Highlight search results