Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WebBrowser form - determine scroll bar position 1

Status
Not open for further replies.

MakeItSo

Programmer
Oct 21, 2003
3,316
0
0
DE
Hi friends,

I am haveing a hopefully relatively simple problem:
I have programmed a sort of HTML compare application.
I first do a series of checks on META tags, links, images etc. and then I want to open two HTML pages simulatenously in a form.
All that I managed to do.
Now I want to be able to scroll both pages simultaneously.
That I also managed at a first step. However, I can so far only scroll once, as I don't know how to determine the current position of the scroll bar.
Here's a snippet of my code with the part in question highlighted:
Code:
MaxScrollY = WebBrowser1.Document.body.scrollHeight ' max scrollable Y position in pixels
    curpos = WebBrowser1.[b]want to read scroll bar pos here[/b]
    If curpos <= 0.8 * MaxScrollY Then
        WebBrowser1.Document.parentWindow.scrollTo 0, curpos + MaxScrollY / 5
        brwWebBrowser.Document.parentWindow.scrollTo 0, curpos + MaxScrollY / 5
    Else
        WebBrowser1.Document.parentWindow.scrollTo 0, MaxScrollY
        brwWebBrowser.Document.parentWindow.scrollTo 0, MaxScrollY
    End If

Obviously, one document is loaded into the "brwWebBrowser", the other into "WebBrowser1".
I will adapt the code later with regards to possible differences of the MaxScrollY for each of the two documents. But that won't be a problem though.

Would be glad for any hint!

Thanks & regards,
Andy

Thanks guys!

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
No one has a clue? Damn!
[cry]

Right now I am using a crude workaround with SendKeys (yuk!)
Code:
WebBrowser1.SetFocus
SendKeys "{down}"
DoEvents
brwWebBrowser.SetFocus
SendKeys "{down}"
DoEvents
Somewhat functional for up/down, but definitely not for good, as the left/right scrolls rather slowly.
I have to "scroll" with "{LEFT 15}", as a single left/right SendKeys will scroll only a tiny bit.

I've searched through the net, but can't find anything!
[sadeyes]

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Waaaah! Got it!
[roll2]

I finally found a hint to the custom scroll bar controls
I'll just add a horizontal and a vertical one in the middle of both and then:
Code:
brwWebBrowser.document.parentWindow.scrollTo 0, VScroll1.Value
WebBrowser1.document.parentWindow.scrollTo 0, VScroll1.Value

*d'oh*
Was obviously too obvious...


[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top