Determining the TextView Position
To determine the position of a TextView control, use the wPositionX
and wPositionY
properties of the iOS TextView
object that TestComplete associates with that control. The following example checks the position of TextView and posts it to the log:
JavaScript, JScript
function Test()
{
// Select the mobile device
Mobile.SetCurrent("iPhone");
// Obtain the TextView object
var p = Mobile.Device().Process("SampleApp");
var textview = p.Window().TextView();
// Post TextView position to the log
Log.Message(textview.wPositionX);
Log.Message(textview.wPositionY);
}
Python
def Test():
# Select the mobile device
Mobile.SetCurrent("iPhone")
# Obtain the TextView object
p = Mobile.Device().Process("SampleApp")
textview = p.Window().TextView()
# Post TextView position to the log
Log.Message(textview.wPositionX)
Log.Message(textview.wPositionY)
VBScript
Sub Test()
Dim p, textview
' Select the mobile device
Mobile.SetCurrent("iPhone")
' Obtain the TextView object
Set p = Mobile.Device.Process("SampleApp")
Set textview = p.Window.textview
' Post TextView position to the log
Log.Message(textview.wPositionX)
Log.Message(textview.wPositionY)
End Sub
DelphiScript
procedure Test();
var
p, textview;
begin
// Select the mobile device
Mobile.SetCurrent('iPhone');
// Obtain the TextView object
p := Mobile.Device.Process('SampleApp');
textview := p.Window.TextView;
// Post TextView position to the log
Log.Message(textview.wPositionX);
Log.Message(textview.wPositionY);
end;
C++Script, C#Script
function Test()
{
// Select the mobile device
Mobile["SetCurrent"]("iPhone");
// Obtain the TextView object
var p = Mobile["Device"].Process("SampleApp");
var textview = p["Window"]()["TextView"]();
// Post TextView position to the log
Log["Message"](textview["wPositionX"]);
Log["Message"](textview["wPositionY"]);
}
Getting Position From Keyword Tests
To get the current text view position 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 Text Edit Controls
Changing Multiline Edit Controls Position
wPositionX Property (iOS Controls)
wPositionY Property (iOS Controls)