Micro Focus QTP (UFT) Forums
right Click on a object - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: right Click on a object (/Thread-right-Click-on-a-object)



right Click on a object - ramesh.tahiliani - 09-12-2009

hi

i wanted to right click the cell of a table and then select some menu option
when i try to record ; nothing comes in the code

I think for right clicking; first we'll hav to set the focus on the required cell and then right click on it .
How will i be abl to do it

Thanks
Ramesh


RE: right Click on a object - Tarik Sheth - 09-13-2009

Hi,

Did you tried getRoproperty for finding x, y coordinates and then 'object.Click [x], [y], 1' where 1 is for right click.


RE: right Click on a object - supputuri - 09-13-2009

Hi tariksheth,

i think it's not a good idea to use the x and y axis propeteries to click on the object generally we should not use x and y axis to identify any object.


RE: right Click on a object - L-mac - 09-14-2009

If may i ask what kind of object are you going to right click? You have to play around with GetROProperty or check out the FIREEVENT

You could try this one.

Code:
Set obj = CreateObject("Mercury.DeviceReplay")
Set WshShell = CreateObject("WScript.Shell")
'Get the absolute coordinates of the Object
absx = menu.QueryValue("abs_x")
absy = menu.QueryValue("abs_y")

obj.MouseClick absx, absy, 2
'Optional wait statement
wait 3

For i = 1 To idx-1
WshShell.sendkeys "{DOWN}"
Next
WshShell.sendkeys "{ENTER}"
Set WshSEll = nothing
Set obj = nothing

Lyndon Mac



RE: right Click on a object - ramesh.tahiliani - 09-14-2009

Sorry , Still not clear with ideas suggested

As one idea was to get the cordinates at run time and click on the object; can we folow it or Do we have some idea better than this

thanks
Ramesh Tahiliani


RE: right Click on a object - Saket - 09-14-2009

I think you can set the focus on required cell using ChildItem.
Have you tried this? you can then do a right click using any of the methods suggested above.


RE: right Click on a object - basanth27 - 09-14-2009

One of the few reasons why QTP wouldnt record is because the object could be a custom object. So, it is necessary to find out the object dev type.

Spying the object is a great value here, Do you get webtable ? If so then you can try the firevent method after selection.

Adding my 2 cents, Obtaining Co-ordinates should be the last resort because they are very much dependent on the system configuration and the application design behaviour.