Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
Drag and Drop
posted

Hi,

I have an scenario where I have to drag a particular text from one location to another. Few examples:

1) Dragging a node from a tree to another control let it be a grid.

2) Dragging a cell from one grid to another.

3) Dragging a coulmn header to another grids header.

(These all deals with dragging a specific text from respective controls.)

I have tried using DragNode, DragItem and the general drag and drop functions.

DragNode and DragItem didn't help me when trying to solve the first issue mentioned above.

So I tried the drag and drop functions. But it needs the x and y coorinates of the text to be dragged and the location to drop.

Is there any way to find the location of a text with in any required control and perform the drag and drop operation?

Also,I will be happy if I can perform the job in different way. Please suggest.

Thanks in Advance

 

  • 7695
    Offline posted

    Hi there,

       Unfortunately there is limited support for Dragging and Dropping between controls. We are looking to implement it on a per control basis, but again at this time it is very limited. Most of it uses the built in Drag x, y, Drop x,y commands built into QTP. In 11.1 we did implement DragSubItem and DropSubItem in the UltraWinTree, this allows you to start a drag operation on one Tree node, and end it by Dropping on a specific Tree Node. This allows you to drag and drop between trees, as well as start a Drag operation from a tree to be continued elsewhere, or end an earlier drag-drop operation by dropping on a node in a tree.

       For interacting with Grids Cells, you can use the GetCellProperty method to get the X, Y, Height and Width of a particular cell to find a valid point in it, to feed into QTP's base Drag x,y and Drop x,y. This should allow you to drag and drop between Grids, as well as Grids and Trees.

     

    Let me know if this helps,