Class library usage, coding and language questions.
- Posts: 1
- Joined: Mon Mar 21, 2011 12:19 pm
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
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.
- Site Admin
- Posts: 11836
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
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.
- Posts: 17
- Joined: Thu Feb 18, 2010 10:06 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.
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
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.