Checking ScrollView's Position Range

Applies to TestComplete 14.20, last modified on September 11, 2019
Getting wMaxDate and wMinDate Properties

To determine the minimum and maximum position of a scroll view control, use the following properties of the iOS ScrollView object:

  • wMaxX– returns the maximum horizontal position of the scroll view.
  • wMaxY– returns the maximum vertical position of the scroll view.
  • wMinX– returns the minimum horizontal position of the scroll view.
  • wMinX– returns the minimum vertical position of the scroll view.

The following example determines the minimum and maximum dates of the ScrollView and posts them to the log:

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the ScrollView object
  var p = Mobile.Device().Process("SampleApp");
  var scrollview = p.Window().ScrollView();

  // Post ScrollView minimum and maximum positions to the log
  Log.Message(scrollview.wMaxX);
  Log.Message(scrollview.wMaxY);
  Log.Message(scrollview.wMinX);
  Log.Message(scrollview.wMinY);
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the ScrollView object 
  p = Mobile.Device().Process("SampleApp")
  scrollview = p.Window().ScrollView()

  # Post ScrollView minimum and maximum positions to the log
  Log.Message(scrollview.wMaxX)
  Log.Message(scrollview.wMaxY)
  Log.Message(scrollview.wMinX)
  Log.Message(scrollview.wMinY)

VBScript

Sub Test()
  Dim p, scrollview
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the ScrollView object
  Set p = Mobile.Device.Process("SampleApp")
  Set scrollview = p.Window.ScrollView

  ' Post ScrollView minimum and maximum positions to the log
  Log.Message(scrollview.wMaxX)
  Log.Message(scrollview.wMaxY)
  Log.Message(scrollview.wMinX)
  Log.Message(scrollview.wMinY)
End Sub

DelphiScript

procedure Test();
var
  p, scrollview;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the ScrollView object
  p := Mobile.Device.Process('SampleApp');
  scrollview := p.Window.ScrollView;

  // Post ScrollView minimum and maximum positions to the log
  Log.Message(scrollview.wMaxX);
  Log.Message(scrollview.wMaxY);
  Log.Message(scrollview.wMinX);
  Log.Message(scrollview.wMinY);
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the ScrollView object
  var p = Mobile["Device"].Process("SampleApp");
  var scrollview = p["Window"]()["ScrollView"]();

  // Post ScrollView minimum and maximum positions to the log
  Log["Message"](scrollview["wMaxX"]);
  Log["Message"](scrollview["wMaxY"]);
  Log["Message"](scrollview["wMinX"]);
  Log["Message"](scrollview["wMinY"]);
}

Checking Position Range From Keyword Tests

To get the mimimum and maximum positions of a scroll view from keyword tests, call the methods described above by using the On-Screen Action or Call Object Method operation. See Calling Object Methods.

See Also

Working With iOS Scroll View Controls
Changing ScrollView Position
wMaxX Property (iOS Controls)
wMaxY Property (iOS Controls)
wMinX Property (iOS Controls)
wMinY Property (iOS Controls)

Highlight search results