Showing results for 
Search instead for 
Did you mean: 

Add DragDrop method to testedobjects

0 Kudos

Add DragDrop method to testedobjects

var obj = someobject;

var destination = someotherobjectl




This would be SO righteously helpful and clean. 


Community Hero
Super Contributor

Yes. Which requires you to calculate the coordinates of the destination. Not a fan. I want someone to calculate it for me. Of course, in the meantime I have to do it anyway. But as I look forward to training my team, I would rater not have to teach them that. So be it. But...

Community Hero

You could create a script extension for them to use so you don't have to train them. 

Super Contributor

Yes, I know. Thanks.

Community Hero

I actually have our drag method added to a script extension.  The code looks like this:


function dragCalculatedDistance(startObject, destinationObject) {
    var startPoint, targetPoint, dragX, dragY;
    // Drag from the center of object A to the center of object B

    startPoint = startObject.WindowToScreen(startObject.Width/2, startObject.Height/2);
    targetPoint = destinationObject.WindowToScreen(destinationObject.Width/2, destinationObject.Height/2);

    dragX = targetPoint.X - startPoint.X;
    dragY = targetPoint.Y - startPoint.Y;

    startObject.Drag(-1, -1, dragX, dragY); 

I wrap that in a script extension and then the method is available for any project.  Give this a try.


Super Contributor

I will, thanks. I think you posted this elsewhere. I still with TestComplete had the ability natively.

Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Join us and watch the welcome video: