Micro Focus QTP (UFT) Forums
How to get the location(x,y) of an highlighted item in WinList - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to get the location(x,y) of an highlighted item in WinList (/Thread-How-to-get-the-location-x-y-of-an-highlighted-item-in-WinList)



How to get the location(x,y) of an highlighted item in WinList - sunnyk8 - 01-10-2012

Hi All,

I have a WinList object and an item is highlighted by default.
I need to get the location of that highlighted item in WinList that can be in the form of x and y coordinates.

Input on this is appreciated.

sunny




RE: How to get the location(x,y) of an highlighted item in WinList - sshukla12 - 01-10-2012

Hi,
Use GetRoProperty to get the cordinates
---.GetRoProperty("x")
---.GetRoProperty("y")

Regards,
Sankalp


RE: How to get the location(x,y) of an highlighted item in WinList - sunnyk8 - 01-10-2012

GetRoProperty("x") and GetRoProperty("y") gives the winlist box x and y coordinates.

I want the x and y coordinates for the highlighted item in the WinList, this highlighted item changes dynamically everytime

Sunny


RE: How to get the location(x,y) of an highlighted item in WinList - Tarik Sheth - 01-11-2012

You can use the following function to accomodate your requirement.

Code:
Public Sub ClickOnTextLocation()
        l = -1
    t = -1
    r = -1
    b = -1
    
    rtn = SwfWindow("xyz").SwfObject("abc").GetTextLocation("pqr",l,t,r,b,True)
    
    myX = SwfWindow("xyz").SwfObject("abc").GetROProperty("x")
    myY = SwfWindow("xyz").SwfObject("abc").GetROProperty("y")
    x= (l+r)/2
    y=(t+b)/2
    
    myX = myX + x
    myY = myY + y
    SwfWindow("xyz").Activate
    Set dr = CreateObject("Mercury.DeviceReplay")
    
    dr.MouseClick myX, myY, 0

End Sub