Drag Method (ImageSetItem Object)

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

Use the Drag action to simulate a dragging event that is performed with the left mouse button over the control specified by its image in the Image Repository.

Declaration

ImageSetItem.Drag(X, Y, toX, toY, Shift, SearchArea)

ImageSetItem
X [in]    Required    Integer    
Y [in]    Required    Integer    
toX [in]    Required    Integer    
toY [in]    Required    Integer    
Shift [in]    Optional    TShiftKey Default value: skNoShift   
SearchArea [in]    Optional    Object    
Result None

Applies To

Parameters

The method has the following parameters:

X

Specifies the horizontal coordinate of the start point for dragging.

This coordinate is relative to the top-left corner of the control’s recognition area marked with a red frame in the Preview box of the ImageSet editor.

If the parameter is omitted, the drag will be simulated in the center of the recognition area.

Y

Specifies the vertical coordinate of the start point for dragging.

This coordinate is relative to the top-left corner of the control’s recognition area marked with a red frame in the Preview box of the ImageSet editor.

If the parameter is omitted, the drag will be simulated in the center of the recognition area.

toX

Specifies the horizontal dragging distance in pixels.

toY

Specifies the vertical dragging distance in pixels.

Shift

Sets whether the Shift, Alt or Ctrl keys are pressed during the dragging (see TShiftKey). By default, this parameter is skNoShift (no shift keys are pressed). Sometimes, the Shift parameter may not be enough, and you may need to simulate key presses in script code. See Simulating Keystrokes.

SearchArea

Specifies the area, within which the method will search for the image. Can take the following values:

  • Your current computer desktop. Access it by calling the Sys object or the Sys.Desktop property.

  • A window or onscreen object in your desktop or web application.

If the parameter is omitted, the method will search for the image on your PC desktop.

Result Value

None.

See Also

Image-Based Testing
DragM Method (ImageSetItem Object)
DragR Method (ImageSetItem Object)
Click Method (ImageSetItem Object)
DblClick Method (ImageSetItem Object)

Highlight search results