Configuration order of direction for mouse movement

Class library usage, coding and language questions.
Ch_Ef
Posts: 10
Joined: Thu Nov 11, 2010 7:37 am

Configuration order of direction for mouse movement

Post by Ch_Ef » Thu Nov 11, 2010 8:06 am

For my tests, i need to access all entries of a menu at my application.
Whenever a menu entry should be clicked or moved to, the mouse moves to the entry in a diagonal way. It starts its way by default at the center of a control.

Is there a possibility to set the order of direction, to make the mouse moving first down and then right (First example)? Or make the mouse moving first right and then down (Second example)?

First example:
[Menu][Menu][Menu] <= MenuBar
[Verylongmenuentry]

Moving to [Verylongmenuentry] causes a selection of a wrong menu, because the mouse "touches" the red [Menu] and opens it. To avoid this, a moving order (down, right) should be configurated.

Second example:
[Menu]
[Menuentry]
[Submenu] => [Submenuentry1]
[Menuentry] _[Submenuentry2]
[Menuentry] _[Submenuentry3]
[Menuentry] _[Submenuentry4]

Moving to [Submenuentry4] causes a selection of a wrong menuentry, because the mouse "touches" the red [Menuentry] and closes the opend [Submenu]. To avoid this the moving order should be right and then down.

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: Configuration order of direction for mouse movement

Post by sdaly » Thu Nov 11, 2010 9:34 am

I had a similar issue and the following worked for me -

Change the location where you click on the menuitem -
menuitem.click(location.centerRight)

and speed up the mouse move time -
adapter.DefaultMoveTime = 20

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

Re: Configuration order of direction for mouse movement

Post by Support Team » Thu Nov 11, 2010 9:53 am

Hi,

You can use sdaly suggestion, or you use a Mouse.MoveTo() Action before you click the sub menu. Then move the mouse for example to the right of the screen for a bit and after the Mouse.MoveTo() finish click the sub menu. You can handle this by code or when you are using recording take a look to following documentation
http://www.ranorex.com/support/user-gui ... -keys.html

Regards,
Peter
Ranorex Team

Ch_Ef
Posts: 10
Joined: Thu Nov 11, 2010 7:37 am

Re: Configuration order of direction for mouse movement

Post by Ch_Ef » Fri Nov 12, 2010 6:28 am

Hi sdaly & Peter,

thank you for your answers. I resolved the issue as follows:
Example1:
  • Click() or MoveTo() with setting a location to move to
Example2:
  • Get width of opened menu
  • Get current mouse position
  • Move mouse in x-direction = current mouse position in x-direction + offset (related to width of opened menu
  • Move mouse in y-direction = current mouse position in y-direction
  • Get submenu item
  • Click() or MoveTo() submenu item
Regards
Christian