Forum Discussion

tiffany_ip's avatar
tiffany_ip
Occasional Contributor
12 years ago

How to get coordinates of items (non-objects) in Lists

Hello,

I need to drag and drop items for a Java Swing List (JList) and it recognizes when I click the item as shown below:

backgroundActionLibrary.ClickItem("Unlatch / Acknowledge all");

I do not know if there is a way to get the coordinates of the item (as itemX and itemY) in that backgroundActionLibrary so I can drag drop.

Also I'm dragging it into a JTable where each cell contains a JList. I need the coordinates of that list object as toX and toY. Is there a way for TestComplete to do this???

backgroundActionLibrary.Drag(itemX, itemY, toX, toY);
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Tiffany,


     


    To help you in creating the script, we need a sample app with the JList control. Can you share it with us?


     

  • Hello, I too have a similar situation where i have to drag an item (probably a cell) from the jtable to another object.



    Example: I am searching for a patient in the list and after I find the patient, I have to drag and drop the patient to a bed (jpanel object).



    In this above example, I was successful in searching the patient using RowIndex and I was able to get the left and top values of jpanel object (bed). However to perform the drag action, I am not sure how will I drag a cell in the row to the jpanel object.



     question is Jobject.Drag(x1,y1, x2, y2) where x2 and y2 value will be the distance of the jpanel object from the cell of jtable, how will i find the x1, y1 value?



    I am attaching the screen of my application