The online community for software testing & quality assurance professionals
 
Active Topics    Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Jobs
Training
News
Links
Downloads

News Group:
software.testing


Testing
Automation
Performance
Engineering
Miscellaneous
Statistics
Poll
  QA Forums
  WinRunner
  How to get the screen cursor pos. and how to deal with focus property

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   How to get the screen cursor pos. and how to deal with focus property
samthi
Member

Posts: 11
Registered: Apr 2003

posted 05-08-2003 05:18 AM     Click Here to See the Profile for samthi   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by samthi
Hi


need to get the left posistion of the text in an edit box.

I am able to get the mouse cursor pos by
obj_click_on_text();
Get_x();
But I am not able to get the Screen Cursor posistion.

i checked and found a function GetCursorPos() a window 32 API function.I don't under stand how to use it.
How to get the sxcreen cursor pos?


2)I am writing a script for the test case that
when page is opened the cursor should be placed in the first editable field.

i am able to catch the first editable field.But i am not able to test either it is focused or not

i tried like this
obj_get_info("MyControl","focused",focus);
the out variable focus is always giving null value.

how to know that the contol is focused or not.

------------------

IP Logged

Stefano
New Member

Posts: 5
Registered: Sep 2002

posted 05-08-2003 06:00 AM     Click Here to See the Profile for Stefano   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Stefano
How to use GetCursorPos() is (well) explained in the ReadMe file.

You can find it under: [WR inst. path]\lib\win32api.

------------------

Stefano Colzani
Opera Multimedia SpA

IP Logged

Charles Reace
Moderator

Posts: 1506
Registered: May 2001

posted 05-08-2003 07:04 AM     Click Here to See the Profile for Charles Reace   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by Charles Reace Visit Charles Reace's Homepage!
Another alternative might be to use the get_x/y functions to get the absolute position, then use win_get_info(window, "x" | "y", value) to get the window's position, then subtract the window's x/y position from the pointer's absolute x/y position to get the position of the pointer relative to the window.

As far as item 2 goes, is "focused" what you really need, or is "enabled" more appropriate? I believe an edit object will not be focused until you acutally click on it or tab into it (i.e.: it is "focused" if any keyboard input would be directed to that object, while it is "enabled" if it is possible to make it focused at this time).

------------------
Charles Reace (charlesDOTreaceATverizonDOTnet)
"Forward!" he cried from the rear, and the front ranks died.
The generals sat, and the lines on the map moved from side to side.

(Roger Waters, "Us and Them")

IP Logged

samthi
Member

Posts: 11
Registered: Apr 2003

posted 05-13-2003 12:18 AM     Click Here to See the Profile for samthi   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by samthi
hi,
thank u for suggesting me.
But my problem is not cleared.
1)when i manually work where ever i click on text there MOUSE CURSOR and SCREEN CURSOR points same location.
But if i run a script saying obj_click_on_text there SCREEN CURSOR is being activated but not MOUSE CURSOR.But functions Get_x() and GetCursorPos()are used to get the MOUSE CURSOR value not SCREEN CURSOR value.

2)I would like to check either the edit box or listbox is focused or not.
we are having a test case when page is opened cursor should be pointed in the first editable field.
how to use focus property.
please any one can help me regarding this.

------------------

IP Logged

All times are PT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A Reply
Hop to:

Contact Us | BetaSoft Inc. | Privacy Statement

Copyright 1997-2003 BetaSoft Inc.


Ultimate Bulletin Board 5.45c