not recording drag and drop

Ranorex Studio, Spy, Recorder, and Driver.
Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

not recording drag and drop

Post by Chris Wright » Wed Jul 27, 2011 3:28 pm

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

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: not recording drag and drop

Post by Ciege » Wed Jul 27, 2011 4:00 pm

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?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: not recording drag and drop

Post by Chris Wright » Thu Jul 28, 2011 2:17 pm

The item is not moving its just the mouse. The action is recorded as a click down in this instance.

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

Re: not recording drag and drop

Post by Support Team » Thu Jul 28, 2011 5:27 pm

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

wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Re: not recording drag and drop

Post by wyll » Wed Aug 01, 2012 3:30 pm

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

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: not recording drag and drop

Post by krstcs » Wed Aug 01, 2012 6:54 pm

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.
Shortcuts usually aren't...

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

Re: not recording drag and drop

Post by artur_gadomski » Thu Aug 02, 2012 8:01 am

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.

wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Re: not recording drag and drop

Post by wyll » Thu Aug 02, 2012 8:16 am

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.

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

Re: not recording drag and drop

Post by Support Team » Thu Aug 02, 2012 12:35 pm

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

wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Re: not recording drag and drop

Post by wyll » Thu Aug 02, 2012 1:21 pm

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.
You do not have the required permissions to view the files attached to this post.

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

Re: not recording drag and drop

Post by Support Team » Thu Aug 02, 2012 3:16 pm

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

wyll
Posts: 34
Joined: Wed Aug 01, 2012 3:19 pm

Re: not recording drag and drop

Post by wyll » Mon Aug 06, 2012 8:19 am

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

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

Re: not recording drag and drop

Post by Support Team » Mon Aug 06, 2012 8:34 am

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