Forum Discussion

awhawh's avatar
awhawh
Contributor
4 years ago
Solved

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

  • 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.

     

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    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.