Description
Use the MouseWheel
method to simulate rotation of the mouse wheel. The method performs the same action as the MouseWheel event of a low-level procedure.
Declaration
LLPlayer.MouseWheel(Delta, Delay)
Delta | [in] | Required | Integer | |
Delay | [in] | Required | Integer | |
Result | None |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
Delta
The distance the mouse wheel will be rotated. One mouse detent is defined by the value 120. So, the Delta parameter must be a multiple of 120: 120, 240, 360, and so on. A positive value means that the wheel will be rotated forward (away from the user); a negative value means the wheel will be rotated backward (toward the user).
Delay
The number of milliseconds passed after you command TestComplete to simulate the rotation of the mouse wheel and before TestComplete starts simulating the rotation. The delay gives you the possibility to better emulate real-life conditions. Also, it is necessary to separate the mouse wheel rotation from other low-level events, so that the operating system can properly process it.
If Delay is negative, it is set to the Auto-wait timeout.
If Delay is greater than 1000, the waiting progress will be shown in the TestComplete indicator during the test run.
Result Value
None.
Example
The code below simulates a click of the left mouse button and then rotation of the mouse wheel using the MouseWheel
method.
JavaScript, JScript
function LLPMouseWheel()
{
// Specifies the coordinates of the first click
var coordX = 15;
var coordY = 120;
// Specifies a delay in milliseconds
var sDelay = 2000; // 2 seconds
// Simulates pressing and releasing the left mouse button
LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay);
LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay);
// Specifies the Delta parameter
var sDelta = 240;
// Simulates rotation of the mouse wheel
LLPlayer.MouseWheel(sDelta, sDelay);
// ...
}
Python
def LLPMouseWheel():
# Specifies the coordinates of the first click
coorX = 15
coorY = 120
# Specifies a delay in milliseconds
sDelay = 2000 # 2 seconds
# Simulates pressing and releasing the left mouse button
LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay)
LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, sDelay)
# Specifies the Delta parameter
sDelta = 240
# Simulates rotation of the mouse wheel
LLPlayer.MouseWheel(sDelta, sDelay)
VBScript
Sub LLPMouseWheel()
' Specifies the coordinates of the first click
coordX = 15
coordY = 120
' Specifies a delay in milliseconds
sDelay = 2000 ' 2 seconds
' Simulates pressing and releasing the left mouse button
Call LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay)
Call LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay)
' Specifies the Delta parameter
sDelta = 240
' Simulates rotation of the mouse wheel
Call LLPlayer.MouseWheel(sDelta, sDelay)
' ...
End Sub
DelphiScript
function LLPMouseWheel;
var coordX, coordY, sDelay, sDelta;
begin
// Specifies the coordinates of the first click
coordX := 15;
coordY := 120;
// Specifies a delay in milliseconds
sDelay := 2000; // 2 seconds
// Simulates pressing and releasing the left mouse button
LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay);
LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay);
// Specifies the Delta parameter
sDelta := 240;
// Simulates rotation of the mouse wheel
LLPlayer.MouseWheel(sDelta, sDelay);
// ...
end;
C++Script, C#Script
function LLPMouseWheel()
{
// Specifies the coordinates of the first click
var coordX = 15;
var coordY = 120;
// Specifies a delay in milliseconds
var sDelay = 2000; // 2 seconds
// Simulates pressing and releasing the left mouse button
LLPlayer["MouseDown"](MK_LBUTTON, coordX, coordY, sDelay);
LLPlayer["MouseUp"](MK_LBUTTON, coordX, coordY, sDelay);
// Specifies the Delta parameter
var sDelta = 240;
// Simulates rotation of the mouse wheel
LLPlayer["MouseWheel"](sDelta, sDelay);
// ...
}
See Also
Testing Applications in Low-Level Mode
MouseWheel Action
LLPlayer.MouseMove Method
LLPlayer.MouseDown Method
LLPlayer.MouseUp Method
Low-Level Procedure Events
Simulating Mouse Wheel Rotation