Google Answers Logo
View Question
 
Q: tracking tab key on web page - retrieving item information as you go ( No Answer,   0 Comments )
Question  
Subject: tracking tab key on web page - retrieving item information as you go
Category: Computers > Programming
Asked by: zuffy99-ga
List Price: $200.00
Posted: 18 Apr 2005 14:38 PDT
Expires: 19 Apr 2005 06:34 PDT
Question ID: 510996
What I want to do is track the items moved to by pressing the tab key.
 The user won't be pressing the tab  key - the tab key will be
"pressed" via program code.  I have no problems tabbing around the web
page - the problems start when I try to read the caption/text of the
item that has been tabbed onto.  I also need to retrieve the screen
position of this item (top or left is sufficient).

Only need to get info for items such as hyperlinks and pop-ups. 
Things like pictures, listboxes can be ignored.

Ideally I'd like this to work in a webBrowser control, but an instance
of Internet Explorer is fine.  VB6 preferred but vb.net ok.

Request for Question Clarification by studboy-ga on 18 Apr 2005 16:12 PDT
Hi zuffy99-ga

Is it possible that you can refer me to your code and env?
It seems like since you're creating the web page and controlling the
tab, there's no reason you cannot extract the caption/text/position of
the elements/controls.

Thanks
studboy-ga

Clarification of Question by zuffy99-ga on 19 Apr 2005 00:27 PDT
Thanks for the prompt response.  I'm not creating the web page, this
code will access an existing web page.

Following example created in VB6 & XP(SP2).  
Add WebBrowser control and button to form.
Navigate to required page in webBrowser.
Code behind button setsfocus to webBrowser and then executes repeated
SendKeys statments to simulate tab key being pressed.  For some reason
have to send two sendkeys to represent one tab.

So far, so good, tab moves around page as expected.  What I need now
is to be able to read the caption/text, screen co-ordinates and
underlying link of the various items I'm tabbing onto.

Thought this would be so straightforward but it's taking up more and
more of my time and I'm still no nearer a solution.  Obviously the
webBrowser recognises which parts of a web page can be tabbed onto but
there doesn't seem to be a property to access this.  Obvious things
like activeControl or setFocus don't work because they apply to the
webBrowser control; not the page inside.  I've messed around with
passing the contents of the webBrowser to an HTML document but I
didn't get any further with that.   Did consider that as the
webBrowser is merely a wrapper around IE, there must be an api related
to IE which is doing the "moving and recognising" on the tab press. 
Then again, part of me hopes it's much more straightforward than that!

Thanks

Clarification of Question by zuffy99-ga on 19 Apr 2005 00:32 PDT
sorry, error in previous clarification.

Code behind button is either 
    wb1.SetFocus
    SendKeys "{TAB}"

OR
    SendKeys "{TAB}"
    SendKeys "{TAB}"
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy