cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Drag action. Out of bounds

SOLVED
Highlighted
Contributor

Issue with Drag action. Out of bounds

Hi,

 

Can someone help me with an issue I'm getting with the Drag action

 

I'm working with a DevExpress list box control which enables the user to drag and drop an item in the list. I firstly find the item according to the parameter passed in and click the item. I then get the mouse coordinates after the click action

 

I then try to use the drag action to take these mouse x y coordinates as the starting point and the use the parameter passed in to set the vertical(y) 'MoveByAmount' 

 

However, when I run it I keep getting the following error There was an attempt to perform an action at point (x, y), which is out of the window bounds.

 

Is there something obvious that I'm doing wrong?

 

function investmentPriority_MoveInvestment(investmentName, moveValue)
{
var listBox = Aliases.PSWizard.XtraForm3.EditFormContainer.EditorContainer.ReservationMethodEditForm.InvestmentPriority

rowCount = listBox.wItemCount

for (i=0;i<rowCount;i++)
{
if (aqConvert.VarToStr(listBox.wItem(i)) == aqConvert.VarToStr(investmentName))
{
listBox.ClickItem(i);

var x = listBox.MousePosition.X
var y = listBox.MousePosition.Y

listBox.Drag(x, y, 0, moveValue)

}
}
}

 

Adam

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Issue with Drag action. Out of bounds

Hi,

 

var x = listBox.MousePosition.X

MousePosition seems to be a native method/property of listBox object. What does it return?

Note, that .Drag() method in TestComplete requires object-relative bit not screen-relative coordinates. See documentation for more details.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

1 REPLY 1
Highlighted
Community Hero

Re: Issue with Drag action. Out of bounds

Hi,

 

var x = listBox.MousePosition.X

MousePosition seems to be a native method/property of listBox object. What does it return?

Note, that .Drag() method in TestComplete requires object-relative bit not screen-relative coordinates. See documentation for more details.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors