Forum Discussion

googleid_107989's avatar
googleid_107989
Occasional Contributor
12 years ago
Solved

How do I get a control from a window location?

In a script.. how do I get the control that is topmost at known window coordinates? 





  • Hi Nigel,



    ObjectFromPoint() method might be the thing that could help...

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Nigel,



    ObjectFromPoint() method might be the thing that could help...
  • googleid_107989's avatar
    googleid_107989
    Occasional Contributor
    I'm thinking of a Hit Test... ie: "What is the top-most control at location x:230 y:430"



    or.. what control would be clicked on it I clicked at x:230 y:430? 



    I could do it by itterating over all controls checking if the point is within the bounds of the control.. then do something to compare all matched leafs on the tree to work out which is on top.. but I assume TestComplete does this already... 



    Is there a function for it? 



    Cheer

    Nigel



  • googleid_107989's avatar
    googleid_107989
    Occasional Contributor
    That is exactly what I was looking for!



    I am testing a silverlight app however and this command gives me  the SLObject  when really want the UIAObject .  Is there a way to get the UIAObject from the SLObject?