BrowserSetScrollPos Function

Action

Scrolls to the specified position inside the active window. In case there are no vertical or horizontal scrollbars, no scrolling will be done. When using the value BROWSER_NO_SCROLL the parameter is ignored.

注: This function only works with Internet Explorer.

Include file

BrowserAPI.bdh

Syntax

BrowserSetScrollPos( nTop               : in number,
                     nLeft              : in number,
                     nRelativeScrolling : in number optional ): boolean;
Parameter Description
nTop The vertical position of the scrollbar. If nRelativeScrolling is set to BROWSER_RELATIVE_SCROLLING this is the offset that is added. Set this parameter to BROWSER_NO_SCROLL if you only want to scroll horizontally.
nLeft The horizontal position of the scrollbar. If nRelativeScrolling is set to BROWSER_RELATIVE_SCROLLING this is the offset that is added. Set this parameter to BROWSER_NO_SCROLL if you only want to scroll vertically.
nRelativeScrolling Optional: If this value is set to BROWSER_RELATIVE_SCROLLING, the values of nTop and nLeft are interpreted as offsets.

Return value

  • true if successful
  • false otherwise

Example

benchmark SilkPerformerRecorder

use "Kernel.bdh"
use "BrowserAPI.bdh"

dcluser
  user
    VUser
  transactions
    TInit           : begin;
    TMain           : 1;

var

dclrand

dcltrans
  transaction TInit
  begin
  end TInit;

  transaction TMain
  var 
    top  : number;
    left : number;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    BrowserNavigate("http://demo.borland.com/TestSite/htmlparser/forms.asp");
    
    // scroll one whole page down (e.g. 600 pixels)
    BrowserSetScrollPos(600,0,BROWSER_RELATIVE_SCROLLING);
    // get the actual scroll position
    BrowserGetScrollPos(top, left);
    // print top, left coordinates
    print(string(top));
    print(string(left));
  end TMain;