🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1072

Re: TCppWebBrowser and scrollIntoView

#1072
From: Remy Lebeau (TeamB)
Date: Fri, 30 Sep 2005 17:27
38 lines
2134 bytes
"Brian Rasmusson" <br@XbitXberXry.com> wrote in message
news:433d23e8$1@newsgroups.borland.com...

> Does anyone have a small example of using scrollIntoView
> to scroll to a named anchor tag??

Here you go:

    #include <utilcls.h>
    #include <mshtml.h>

    void __fastcall TForm1::ScrollWBToAnchor(const WideString &AnchorName)
    {
        if( CppWebBrowser1->ReadyState == READYSTATE_COMPLETE )
        {
            TComInterface<IHTMLDocument2> Doc = (IDispatch*)
CppWebBrowser1->Document;
            if( Doc )
            {
                TComInterface<IHTMLElementCollection> Anchors;
                if( SUCCEEDED(Doc->get_anchors(&Anchors)) )
                {
                    TComInterface<IDispatch> Disp;
                    if( SUCCEEDED(Anchors->item(TVariant(AnchorName),
TVariant((int)0), &Disp)) )
                    {
                        TComInterface<IHTMLElement> Anchor = Disp;
                        if( Anchor )
                            Anchor->scrollIntoView(TVariant(true));
                    }
                }
            }
        }
    }


Gambit
Technical Details
Message-ID: <433d7554$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <433d23e8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,90af7ce9f2204e2c
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <433d23e8$1@newsgroups.borland.com>
Subject: Re: TCppWebBrowser and scrollIntoView
Date: Fri, 30 Sep 2005 10:27:15 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <433d7554$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1128101204 68.69.17.41 (30 Sep 2005 10:26:44 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail