Drag Adapter Problem

Class library usage, coding and language questions.
robbell
Posts: 1
Joined: Mon Mar 21, 2011 12:19 pm

Drag Adapter Problem

Post by robbell » Mon Mar 21, 2011 12:40 pm

Hi,

I'm trying to drag an adapter item to another in a WPF app using the Mouse.MoveTo, ButtonDown and ButtonUp methods but I'm experiencing some odd behaviour. In the code below the initial MoveTo operates correctly and I can see from breakpoints being hit that the following ButtonDown is being called, but the following MoveTo isn't being called.

Code: Select all

Mouse.MoveTo(source);
Mouse.ButtonDown(MouseButtons.Left);
Mouse.MoveTo(destination, location);
Mouse.ButtonUp(MouseButtons.Left);
When the test is running, if I wiggle the mouse a bit manually once the ButtonDown has been called, then the second MoveTo executes. Also if I comment out the ButtonDown, the two MoveTos are both executed correctly.

Any suggestions as to why it's not working? I've had a look at some similar posts but with no luck. The element repository contains the parent to the source and destination controls and I've tried setting the "Use Ensure Visible" to false.

Thanks,

Rob

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Drag Adapter Problem

Post by Support Team » Mon Mar 21, 2011 2:41 pm

Hi,

Would it be possible to send us a sample application to reproduce the problem, because I tried an example and it is working as expected. I used your posted code for this example and it works.

Thanks in advance.

Regards,
Peter
Ranorex Team

Munro89
Posts: 17
Joined: Thu Feb 18, 2010 10:06 pm

Re: Drag Adapter Problem

Post by Munro89 » Fri Mar 25, 2011 3:22 pm

I had the same problem here.

I noticed that doing a Mouse.Click before calling the Mouse.ButtonDown makes it work, but sometime it was too fast for our application. Adding a delay (even 10ms) between the Click and ButtonDown made it fail everytime, just as if we used MoveTo and ButtonDown.

I solved it by adding a delay of 25ms between the Mouse.MouseDown and Mouse.MoveTo (to our new Adapter). Now it seem to always work.

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Drag Adapter Problem

Post by artur_gadomski » Mon Mar 28, 2011 8:05 am

What's your default mouse move speed? I remember ciege writing somewhere that he needs to have a speed greater than 0 for dragging operations.