Get cursor coordinates over tested object?
Does anyone have a way a to get the cursor coordinates over a tested object during test execution?
I am working an unsupported control and I have a method to place the cursor over a particular region of this control. If I use TestComplete to send a double click, it will click at 0,0 of that object instead of where the cursor is currently residing. If I had a way to get the current coordinates of the mouse cursor I could send that to the double-click action.
Alternatively, if there was a way to send a double click command to the current cursor location, that would work too.
Any ideas?
Thanks for the assistance everyone, I was able to get what I needed. Here's the script I wrote to get the current X & Y coordinates and double click the object at that point.
var screenMouseX, screenMouseY, controlPoint, onscreenObj; function double_click() { //Gets current mouse cursor coordinates on screen screenMouseX = Sys.Desktop.MouseX; screenMouseY = Sys.Desktop.MouseY; Log.Message("X: " + screenMouseX + " Y: " + screenMouseY); //gets the object below the mouse cursor onscreenObj = Sys.ObjectFromPoint(screenMouseX,screenMouseY); //converts the screen coordinates to coordinates relative to the object controlPoint = onscreenObj.ScreenToWindow(screenMouseX,screenMouseY); Log.Message("objX: " + controlPoint.X + " objY: " + controlPoint.Y); //double clicks the object from the converted coordinates onscreenObj.DblClick(controlPoint.X,controlPoint.Y); }