Forum Discussion

anapao's avatar
anapao
Occasional Contributor
4 years ago
Solved

Object cannot be recognized again once it has been clicked

Hi everybody,   I have an object that is not mapped automatically and therefore I have to work with it as an ImageRepositoryObject.   I want to drag the object. To extract the coordinates, I clic...
  • AlexKaras's avatar
    4 years ago

    Hi Paola,

     

    I do know that the click action is being succesfull because I get the right coordinates.

    a) Is there any chance that object is regenerated after click? If it is, then this may explain the error message, because your code does not search for the object before dragging but uses stored reference to it. And if the object is regenerated this invalidates the stored reference.

    You may try to replace .Click() call with the .HoverMouse() one. This should return same coordinates but should not cause any object regeneration (if any);

    b) Your code for drag seems to be incorrect. It uses absolute screen coordinates (e.g. Sys.Desktop.MouseX) while, as per documentation, the .Drag() method uses object-relative coordinates for drag start and not the final point but distance to drag for end. See method's description and code sample for more details.