Version

Emulating the Mouse

Topic Overview

Purpose

This topic provides reference information about the methods for mouse action emulation on Infragistics controls.

Supported Mouse Actions Summary

Supported mouse actions summary chart

The following table maps the supported user mouse actions to the Test Automation methods that emulate them. Some actions are supported by two methods depending on whether the action is performed on the entire control, for example, on the whole grid, or on some of its parts, like a cell of the grid. (See Mouse Action Emulation Methods Summary.)

Mouse action Method

Left-click

_<<Ref328523447, ClickSubItem >>_
_<<Ref328523618, MouseActionOnControl >>_
_<<Ref328523624, MouseActionOnSubItem >>_

Double-click

_<<Ref328523612, DblClickSubItem >>_
_<<Ref328523618, MouseActionOnControl >>_
_<<Ref328523624, MouseActionOnSubItem >>_

Right-click

_<<Ref328483575, RightClickSubItem >>_
_<<Ref328523618, MouseActionOnControl >>_
_<<Ref328523624, MouseActionOnSubItem >>_

Mouse down

_<<Ref328523624, MouseActionOnSubItem >>_

Mouse up

_<<Ref328523624, MouseActionOnSubItem >>_

Mouse move

_<<Ref328523624, MouseActionOnSubItem >>_

Mouse Action Emulation Methods

Mouse action emulation methods summary chart

The following table briefly explains the methods for emulating user mouse actions. The Operation level column of the table indicates whether the method operates on the control as a whole, at the control operational level, for example, on the whole grid, or on some of its parts (sub-item operational level), for example, a cell of the grid. Detailed information about the methods is provided in the text blocks following the table.

The accessibility of each method is specific to the control that is calling the method. For details, please refer to the documentation of the respective control, the Testable User Actions and Elements topic.

Method Operation level Description

control

Performs a left-click on the control.

sub-item

Performs a left-click on a specified sub-item of the control.

control

Performs a double-click on the control.

sub-item

Performs a double-click on a sub-item of the control.

control

Performs one of several mouse actions on the control. Including: left-click, double-click, right-click, mouse down, mouse up, mouse move.

sub-item

Performs one of several Mouse actions on a sub-item of the control. Including: left-click, double-click, right-click, mouse down, mouse up, mouse move.

control

Performs a right-click on the control.

sub-item

Performs a right-click on a sub-item of the control.

ClickControl

Description

The ClickControl method performs a left-click on the control.

Supported controls

All Infragistics controls.

Parameters

The following table explains the method’s parameters.

Method Parameter Description

oRegion

(required)

Specifies the reference point in the control relative to which the click will occur.

The allowed enumerated values are:

  • igAt

  • igBottomCenter

  • igBottomLeft

  • igBottomRight

  • igMidCenter

  • igMidLeft

  • igMidRight

  • igPercent

  • igTopCenter

  • igTopLeft

  • igTopRight

oDouble1

Depending on the value of oRegion, is either a number representing the x-coordinate of the mouse click location or the distance of the click from the oRegion.

oDouble2

A number representing the y-coordinate of the mouse click location.

Examples

The following image presents the mouse click locations used in the examples. The size of the xamGeographicMap control is 1000x1000 pixels. The ClickControl parameters are shown in blue, and the location’s x-,y-coordinates – in black.

TAWPF Direct Mouse Manipulation 1.png

Example 1

Clicking at the x-y coordinates (200,305) on the xamDataChart :

WpfWindow("MainWindow").XamDataChart("chart").ClickControl igAt, 200, 305 Example 2

Clicking the top right corner of the xamGeographicMap :

WpfWindow("MainWindow").XamGeographicMap("map").ClickControl igTopRight Example 3

Clicking a point 200 pixels inside the top right corner of a 1000x1000 xamGeographicMap :

WpfWindow("MainWindow").XamGeographicMap("map").ClickControl igTopRight, 200 Example 4

Clicking the middle of the xamGeographicMap :

WpfWindow("MainWindow").XamGeographicMap("map").ClickControl igMidCenter Example 5

Clicking a point 100 pixels diagonally away from the middle (toward the upper left corner) on a 1000x1000 xamGeographicMap :WpfWindow("MainWindow").XamGeographicMap("map").ClickControl igMidCenter, 100

Example 6

Clicking a point 20% from the left margin and 50% from the top of the xamGeographicMap :

WpfWindow("MainWindow").XamGeographicMap("map").ClickControl igTopRight

ClickSubItem

Description

The ClickSubItem method emulates a mouse click on a control’s specific sub-item.

Supported controls

Parameters

The following table explains the method’s parameters.

Method Parameter Description

oeSubItemType

Specifies the type of sub-item that the click will occur on (for example, a grid cell).

oSubItem

Uniquely identifies the sub-item on which the click will occur.

oRegion

(required)

Specifies a reference point in the sub-item relative to which the click will occur.

The allowed enumerated values are:

  • igAt

  • igBottomCenter

  • igBottomLeft

  • igBottomRight

  • igMidCenter

  • igMidLeft

  • igMidRight

  • igPercent

  • igTopCenter

  • igTopLeft

  • igTopRight

oDouble1

Depending on the value of oRegion, this is either a number representing the x-coordinate of the mouse click location or the distance of the click from the oRegion.

oDouble2

Number representing the y-coordinate of the mouse click’s location.

Example

Clicking a grid cell to toggle the checked state of a checkbox in the cell.

TAWPF Direct Mouse Manipulation 2.png

In this example, the oeSubItemType parameter value is gridCell and the oSubItem parameter value is the string, {5}[ForSale], which specifies the row by index and the column by key.

WpfWindow("MainWindow").XamDataGrid("grid").ClickSubItem gridCell,"{5}[ForSale]",igMidCenter

(Refer to Illustration above.)

DblClickControl

Description

The DblClickControl method performs a double-click action on the control.

Supported controls

All Infragistics controls.

Parameters

The DblClickControl method has the same parameters as the ClickControl.

DblClickSubItem

Description

The DblClickSubItem method performs a double-click on a sub-item of the control.

Supported controls

  • xamDataPresenter

    • xamDataCards

    • xamDataCarousel

    • xamDataGrid

  • xamGrid

Parameters

The DblClickSubItem method has the same parameters as the ClickSubItem.

MouseActionOnControl

Description

The MouseActionOnControl method performs the following mouse actions on a specified location on the control:

  • Left-click

  • Double-click

  • Right-click

  • Mouse down

  • Mouse up

  • Mouse move

Details

As the MouseActionOnControl method supports several different mouse actions, the exact action to perform is specified with a parameter. (For details, see Parameters.)

Supported controls

All Infragistics controls.

Parameters

The following table explains the method’s parameters.

Method Parameter Description

oeMouseAction

(required)

Specifies the mouse action that will occur.

The allowed enumerated values are:

  • igAt

  • igBottomCenter

  • igBottomLeft

  • igBottomRight

  • igMidCenter

  • igMidLeft

  • igMidRight

  • igPercent

  • igTopCenter

  • igTopLeft

  • igTopRight

oRegion (required)

Specifies a reference point in the control relative to which the mouse action will occur.

oDouble1

Depending on the value of oRegion, this is either a number representing the x-coordinate of the mouse action location or the distance of the mouse action from the oRegion.

oDouble2

Number representing the y-coordinate of the mouse action location.

Example

Replaying a user’s dragging the mouse to zoom action into the xamDataChart . The zoom rectangle, generated by this move starts 10 pixels above and to the left of the middle of the chart and ends 50 pixels above and to the left of the bottom right corner.

TAWPF Direct Mouse Manipulation 3.png

Set chart=WpfWindow("MainWindow").XamDataChart("chart1")

chart1.MouseActionOnControl igMouseDown, igMidCenter, -10

chart1.MouseActionOnControl igMouseMove, igBottomRight, 50

MouseActionOnSubItem

Description

The MouseActionOnSubItem method performs the following mouse actions on a sub-item of the specified control:

  • Left-click

  • Double-click

  • Right-click

  • Mouse down

  • Mouse up

  • Mouse move

Details

As the MouseActionOnSubItem method supports several different mouse actions, the exact action to perform is specified with a parameter. (For details, see Parameters.)

Supported controls

  • xamDataPresenter

    • xamDataCards

    • xamDataCarousel

    • xamDataGrid

  • xamGrid

Parameters

The following table explains the method’s parameters.

Method Parameter Description

oeMouseAction

(required)

Specifies the mouse action that will occur (for example, mouse move).

The allowed enumerated values are:

  • igClick

  • igDblClick

  • igMouseDown

  • igMouseMove

  • igMouseUp

  • igRightClick

oeSubItemType

(required)

Specifies the type of sub-item that the mouse action will occur on (for example, a grid cell).

oSubItem

(required)

Uniquely identifies the sub-item upon which the mouse action will occur.

oRegion

(required)

Specifies a reference point in the sub-item relative to which the mouse action will occur.

The parameter oRegion, which is required by this method, must have one of the following enumerated values:

  • igAt

  • igBottomCenter

  • igBottomLeft

  • igBottomRight

  • igMidCenter

  • igMidLeft

  • igMidRight

  • igPercent

  • igTopCenter

  • igTopLeft

  • igTopRight

oDouble1

Depending on the value of oRegion, this is either a number representing the x-coordinate of the mouse action location or the distance of the action from the oRegion.

oDouble2

A number representing the y-coordinate of the mouse action location.

Example

This example demonstrates how to emulate a drag-drop operation that moves a tree node Tonka from one xamDataTree to another.

TAWPF Direct Mouse Manipulation 4.png

In the example, there are three calls specifying igMouseMove. While it is not always necessary to implement all three calls, this is the recommended approach. Your actual requirements vary depending on how the application itself implements the drag-drop function. The following is the recommended approach, using three calls:

  • one igMouseMove call inside the source sub-item, at a point differing by at least 3 pixels from the starting point

  • one igMouseMove call external to the source sub-item, but inside the starting control

  • one igMouseMove call inside the target sub-item, but differing from the end point by at least three pixels

Set left_tree = WpfWindow("MainWindow").XamDataTree("xamTree1")

Set right_tree = WpfWindow("MainWindow").XamDataTree("xamTree2")

left_tree.MouseActionOnSubItem igMouseDown,treeNode, ARRAY("WDJohnson", "Tonka")

left_tree.MouseActionOnSubItem igMouseMove,treeNode, ARRAY("WDJohnson", "Tonka"),igMidCenter,5

left_tree.MouseActionOnControl igMouseMove,igMidRight

right_tree.MouseActionOnSubItem igMouseMove,treeNode, ARRAY("CityWide", "BMW"),igTopCenter,3

right_tree.MouseActionOnSubItem igMouseUp,treeNode, ARRAY("CityWide", "BMW") ,igTopCenter

RightClickControl

Description

The RightClickControl method performs a right-click on the control.

Supported controls

All Infragistics controls.

Parameters

The RightClickControl method has the same parameters as the ClickControl.

RightClickSubItem

Description

The RightClickSubItem method performs a right-click on a sub-item of the control.

Supported controls

  • xamDataPresenter

    • xamDataCards

    • xamDataCarousel

    • xamDataGrid

  • xamGrid

Parameters

The RightClickSubItem method has the same parameters as the ClickSubItem.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides reference information about the methods for accessing the properties and sub-properties of Infragistics controls.

This topic provides reference information about the methods for emulating of panning and zooming actions on Infragistics controls.

This topic provides reference information about the methods for setting the application’s focus directly on a control (without emulating any mouse or key actions).