BrowserGetScrollPos Function

Action

Returns the current scrollbar position of the active window. In case there are no vertical or horizontal scrollbars, the values are set to zero.

注: This function only works with Internet Explorer.

Include file

BrowserAPI.bdh

Syntax

BrowserGetScrollPos( nTop  : out number,
                     nLeft : out number ): boolean;
Parameter Description
nTop The current vertical position of the scrollbar.
nLeft The current horizontal position of the scrollbar.

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;