Page 1 of 1

not recording drag and drop

Posted: Wed Jul 27, 2011 3:28 pm
by Chris Wright
HI,

I am trying to record a function that drags and drops dates into a calendar. Upon playback Ranorex replays the first click on the item and moves to the location that it should but without dragging the item accross?

Can anyone tell me why this might be?

Thanks
Chris

Re: not recording drag and drop

Posted: Wed Jul 27, 2011 4:00 pm
by Ciege
Chris Wright wrote:moves to the location that it should but without dragging the item accross?
Is the item itself moving or just the mouse?
Did you issue a click on the object (which is actually a click and release or did you issue a mouse down, then move, then a mouse up?

Re: not recording drag and drop

Posted: Thu Jul 28, 2011 2:17 pm
by Chris Wright
The item is not moving its just the mouse. The action is recorded as a click down in this instance.

Re: not recording drag and drop

Posted: Thu Jul 28, 2011 5:27 pm
by Support Team
Do you run the automation in Turbo Mode, i.e. without delays at full speed? Some controls want to be clicked for half a second or so before the enter drag & drop mode.

Another possible cause could be a focus problem. Try clicking the item first, then delay execution for a second, then start the drap & drop operation (mouse down -> move -> mouse up).

Regards,
Alex
Ranorex Team

Re: not recording drag and drop

Posted: Wed Aug 01, 2012 3:30 pm
by wyll
hello,

have the same issue.

there is the code

Code: Select all

            repo.myApp.MoveTo
                  (new Location(bmp, "120;100"),1000);
      	    Delay.Milliseconds(1000);

            Mouse.ButtonDown(Windows.Forms.MouseButtons.Left);
            Delay.Milliseconds(1000);

            repo.myApp.MoveTo
                   (new Location(bmp,"-30;30"),1000);
            Delay.Milliseconds(1000);

            Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left);
Basically, what it suppose to do is to find the image and select it with a selection rectangle
it worked before with ranorex 3.2, updated it to 3.3 today and it doesn't seem to work.

regards,
Wyll

Re: not recording drag and drop

Posted: Wed Aug 01, 2012 6:54 pm
by krstcs
You should probably be using the Mouse.MoveTo method, which actually moves the mouse pointer, instead of trying to move the object in your application under test.

If you are trying to manipulate the mouse, try using the mouse methods directly.

See the Ranorex API -> Ranorex Namespace -> Mouse.MoveTo(Point), etc.

Code: Select all

                Mouse.ButtonDown(Windows.Forms.MouseButtons.Left);
                Delay.Milliseconds(1000);

--->>>          Mouse.MoveTo(repo.MyApp, new Location(bmp,"-30;30"));
                Delay.Milliseconds(1000);

                Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left);
You will, of course, need to verify the correct references.

Re: not recording drag and drop

Posted: Thu Aug 02, 2012 8:01 am
by artur_gadomski
http://www.ranorex.com/Documentation/Ra ... MoveTo.htm

MoveTo method actually moves the mouse to location within the control, so I'd say the usage is correct.

Looks like Move method tries to move the control.

Re: not recording drag and drop

Posted: Thu Aug 02, 2012 8:16 am
by wyll
krstcs wrote:You should probably be using the Mouse.MoveTo method, which actually moves the mouse pointer, instead of trying to move the object in your application under test.

If you are trying to manipulate the mouse, try using the mouse methods directly.

See the Ranorex API -> Ranorex Namespace -> Mouse.MoveTo(Point), etc.

Code: Select all


You will, of course, need to verify the correct references.
hello again,

well, you can see the mouse moves to the right spot with my code, but it doesnt seem to press the left mousebutton down. Also tried to change to mouse.moveto() but it doesn't seem to work also.
And again it worked with the 3.2 version of ranorex

regards,
wyll

EDIT: hardcoded mouseposition without using the image references seems to work fine, but this can't be the solution to it.

Re: not recording drag and drop

Posted: Thu Aug 02, 2012 12:35 pm
by Support Team
Hi Wyll,

The problem in your code is not in using "Mouse.MoveTo(elem)" or "elem.MoveTo()". This is working fine in both ways (also in 3.3.1). I think problem is "new Location(...)". Do you have checked if the search for the bitmap works well? Is the Location in the bitmap the right one (-30)?

Regards,
Larissa
Ranorex Support Team

Re: not recording drag and drop

Posted: Thu Aug 02, 2012 1:21 pm
by wyll
hello,

i attached a picture of how it used to work, but now doesn't.
the mouse position starts at the red dot and holds down the button until the blue dot.

yes image find should also be sucessful since the mouse is moving to there.
(and shouldnt there be an Error in the log "for not finding the image"?)
my code had a minor mistake it should be (-30,-30) so to prevent clicking on the icon it is negative.

Re: not recording drag and drop

Posted: Thu Aug 02, 2012 3:16 pm
by Support Team
Hi,

I reproduced your desired activity and had no problems with clicking. Nevertheless it took a while finding the "folder-image". My code looks exactly like yours except the timing of the 1000 ms in MoveTo - I skipped the timing. Is your AUT always in the foreground during your test?
I just recognized that you have one time "Windows.Forms.MouseButtons.Left" and the other time "System.Windows.Forms.MouseButtons.Left". You can include
using WinForms = System.Windows.Forms;
and call WinForms.MouseButtons.Left to be conform.

Regards,
Larissa
Ranorex Support Team

Re: not recording drag and drop

Posted: Mon Aug 06, 2012 8:19 am
by wyll
Hello Larissa,

thank you for your help. yes my AUT is in the foreground during the test. is there a way not to do it in the foreground?

just in case, I will just hardcode the mouse coordinates and hope the object never gets moved. :D
oh well,


regards,

wyll

Re: not recording drag and drop

Posted: Mon Aug 06, 2012 8:34 am
by Support Team
Hi,

Your AUT should always be in the foreground. If it is not there will occur problems with finding the objects, of course. I just want to be sure that in your case this was not the reason for your problem.

Regards,
Larissa
Ranorex Support Team