Hold down a key while clicking and dragging the mouse

Class library usage, coding and language questions.
aldo.longhi
Posts: 4
Joined: Thu Mar 18, 2010 1:19 am

Hold down a key while clicking and dragging the mouse

Post by aldo.longhi » Thu Mar 18, 2010 1:26 am

Hello.

I am using Ranorex.Net v1.4 on Windows (Win2000, WinXP, Win7) machines. I have a need to perform the following sequence of actions:

1) Press and hold a key on the keyboard (Ctrl)
2) Click and drag with a mouse button (left button for now, but possibly other buttons later)
3) Release the keyboard key

I will also need to do a similar sequence with merely a click (no drag) in step 2.

I have not found any way to do this with the 1.4 (.Net) API. I have seen the methods Keyboard.Down and Keyboard.Up in the 2.X API, but I do not have that version of Ranorex (yet).

Is there any way to perform this sequence using Ranorex.Net v1.4?

Thank you.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Hold down a key while clicking and dragging the mouse

Post by Support Team » Thu Mar 18, 2010 11:38 am

Hi,

Yes, it is possible and the Ranorex Recorder 1.4 (or above) should be able to record drag & drop operations. If you don't use the recorder, you need to send keyboard inputs to the application to hold down a key (e.g. "{CTRLDOWN}"); then do the drag/drop mouse action; then release the key again (e.g. "{CTRLUP}". You send keys to an application using the the Application.SendKeys method:
http://www.ranorex.com/Documentation/Ne ... ndKeys.htm

Regards,
Alex
Ranorex Support Team
.
Image