This project is read-only.

Does drag and drop generate a double-click?

Oct 6, 2009 at 6:42 PM


  I am trying to drag and drop an image into a tree node for a particular test.  The image also responds to a double-click event and launches and image editor.

  The problem is that when I use drag and drop, the image editor pops up and then I see the mouse move.  It's almost like the drag and drop function generated a double-click first.

  This is my code (using IronRuby to talk to White):


poster_image  = @main_window.get(SearchCriteria.by_automation_id("clickToPlay"))

index_66_item = @main_window.get(SearchCriteria.by_automation_id("tvStoryImages")).nodes[3]

@main_window.mouse.drag_and_drop(poster_image, index_66_item)


Also, my DragStepCount is set to 10.


Any help would be greatly appreciated.





Oct 17, 2009 at 11:58 AM

Drag and drop does mouse down, mouse up, mouse down, move and mouse up.

Have you tried using the same sequence of events manually in your application?

Jul 27, 2010 at 11:13 AM

Normally in any application this would cause a double click if the timespan of the mouse down, mouse up, mouse down is very less i.e. less than the double click time.

So the 'HoldForDrag' function should look like this

DateTime lastClickTime = DateTime.Now;

int timeout = doubleClickTime - DateTime.Now.Subtract(lastClickTime).Milliseconds;
if (timeout > 0) Thread.Sleep(timeout + extraMillisecondsBecauseOfBugInWindows);

Jul 29, 2010 at 3:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.