Results 1 to 5 of 5

Thread: Delphi, TWebBrowser, Disable Scrollbars???

  1. #1
    Join Date
    Jul 2010
    Posts
    37

    Delphi, TWebBrowser, Disable Scrollbars???

    Hi! How can I disable scroll-bars in TWebBrowser component. I can find it.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,288

    Re: Delphi, TWebBrowser, Disable Scrollbars???

    There are two properties in the Document.Body.Style property, named OverflowX and OverflowX. Simply set them to 'hidden' as shown in the code snippet below.

    For more information on the TWebBrowser's document properties, see the other tips listed at the top.

    Code:
    begin
      // .. 
      with WebBrowser1.Document.Body.Style do
      begin
        OverflowX := 'hidden';
        OverflowY := 'hidden';
      end; { with WebBrowser1 }
    
      // ..
    end;

  3. #3
    Join Date
    Jul 2010
    Posts
    37

    Re: Delphi, TWebBrowser, Disable Scrollbars???

    Well, I tried it, but there are 2-3 mistakes.

    Code:
    WebBrowser1.Document.Style.OverflowX....
    doesn't work. There are 3 errors.

    Code:
    WebBrowser1.OleObject.Body.Style.OverflowX...
    doesn't work, but there are 2 errors. The sign ":" causes 1 error and "end;" causes another error. Why?

    What is the actual different between "...Document..." and "...OleObject..."?

    See the attached files for more details.
    Attached Images Attached Images

  4. #4
    Join Date
    Aug 2006
    Posts
    103

    Re: Delphi, TWebBrowser, Disable Scrollbars???

    This solution was used on other site, if you save the next code as index.htm and another html file to home.htm and then navigate the browser to index.htm then you get the home.htm page without the scrollbars. (just copied the htmlcode, so I have no idea what happens, it might be easier another way)

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

    <html>
    <head>
    <title></title>
    </head>
    <script type="text/javascript">
    // <![CDATA[
    //check whether the frameset has been redirected to by a contentpage which has been loaded outside this frameset

    var contentFrameStr = 'home.htm';

    if(location.href.indexOf('?') != -1){
    urlSplit = location.href.split('?');
    paramSplit = urlSplit[1].split('=');
    if(paramSplit[0] == "requestedPage"){
    contentFrameStr = paramSplit[1];
    }
    }

    var framesetStr = '<frameset id="mainFrame" rows="95, *" frameborder="no" border="0" framespacing="0">'; // border="0"

    framespacing="0" are actually not tolerated by xhtml
    framesetStr += '<frame src="menu.htm" id="topFr" name="topFr" marginwidth="0" frameborder="0" noresize="noresize"

    scrolling="no"></frame>';
    framesetStr += '<frame src="'+contentFrameStr+'" id="botFr" name="botFr" marginwidth="0" frameborder="0"

    noresize="noresize" scrolling="no"></frame>';
    framesetStr += '</frameset>';

    parent.document.open();
    parent.document.write(framesetStr);
    parent.document.close();
    /*if(document.getElementById) xhtmlHack();

    function xhtmlHack(){
    var el = document.getElementsByTagName('FRAMESET')[0];
    el.setAttribute('frameborder', '0');
    el.setAttribute('border', '0');
    el.setAttribute('framespacing', '0');
    //rameborder=no border=0 framespacing=0

    el = document.getElementsByTagName('FRAME')[0];
    el.setAttribute('scrolling', 'no');
    el.setAttribute('resize', 'false');
    el.setAttribute('border', '0');
    el.setAttribute('marginwidth', '0');
    el.setAttribute('marginheight', '0');
    //marginwidth=0 noresize scrolling="no"

    el = document.getElementsByTagName('FRAME')[1];
    el.setAttribute('scrolling', 'no');
    el.setAttribute('resize', 'false');
    el.setAttribute('border', '0');
    el.setAttribute('marginwidth', '0');
    el.setAttribute('marginheight', '0');
    }*/
    //]]>
    </script>
    </html>

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

    and another page as home.htm
    Patience is a virtue

  5. #5
    Join Date
    Jul 2010
    Posts
    37

    Re: Delphi, TWebBrowser, Disable Scrollbars???

    EINSTEIN_007's code makes mire sense.

Similar Threads

  1. TWebBrowser popup window Problem (Delphi)
    By lucky3664 in forum Software Development
    Replies: 2
    Last Post: 06-03-2012, 11:25 AM
  2. Delphi, TWebBrowser, Centralized Window?!
    By alex198555 in forum Software Development
    Replies: 3
    Last Post: 29-07-2010, 11:21 AM
  3. Delphi, TWebBrowser & Java Scripts.
    By alex198555 in forum Software Development
    Replies: 1
    Last Post: 28-07-2010, 11:23 AM
  4. Delphi, TWebBrowser, Web-Site Login?!
    By alex198555 in forum Software Development
    Replies: 1
    Last Post: 28-07-2010, 11:11 AM
  5. Delphi, TWebBrowser, Auto-Refresh???
    By alex198555 in forum Software Development
    Replies: 3
    Last Post: 22-07-2010, 10:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,801,744.67708 seconds with 17 queries