xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Scroll()

Scrolls a screen region horizontally and/or vertically.

Syntax

Scroll( [<nTop>]   , ;
        [<nLeft>]  , ;
        [<nBottom>], ;
        [<nRight>] , ;
        [<nRows>]  , ;
        [<nColumns>] ) --> NIL

Arguments

<nTop>
A numeric value indicating the screen coordinate for the top row of the rectangular screen region to scroll. The default value is 0.
<nLeft>
A numeric values indicating the screen coordinate for the left column of the rectangular screen region to scroll. The default value is 0.
<nBottom>
A numeric value indicating the screen coordinate for the bottom row of the rectangular screen region to scroll. The default value is MaxRow().
<nRight>
A numeric values indicating the screen coordinate for the right column of the rectangular screen region to scroll. The default value is MaxCol().
<nRows>
This is a numeric value indicating the number of rows to scroll the screen region in vertical direction. A positive value scrolls left, while negative values scroll right. The default value is zero, which does not scroll vertically.
<nColumns>
This is a numeric value indicating the number of columns to scroll the screen region in horizontal direction. A positive value scrolls up, while negative values scroll down. The default value is zero, which does not scroll horizontally.

Return

The return value is NIL.

Description

Scroll() manipulates the screen display in a console window by moving a rectangular area in horizontal and/or vertical direction. This is accomplished by deleting a row and/or column in scroll direction, shifting the screen area and displaying a blank row and/or column at the end using the standard color. This is repeated until the number of rows and/or columns specified is reached.

Note:  if NIL is passed for both, <nRows> and <nColumns>, the entire rectangle defined with <nTop>, <nLeft>, <nBottom> and <nRight> is blanked.

Info

See also:@...BOX, @...CLEAR, @...TO, CLEAR SCREEN, RestScreen(), ScrollFixed()
Category: Screen functions
Source:rtl\scroll.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays numbers 0 to 50 in a screen area that has only
// ten rows. When the screen cursor hits the bottom of the area, the
// display is scrolled up.

   PROCEDURE Main
      LOCAL nTop:= 10, nLeft:=10, nBottom:=20, nRight:=20, cScreen
      LOCAL nRow, nCol, n

      CLS
      SET COLOR TO W+/B
      DispBox( nTop-1, nLeft-1, nBottom+1, nRight+1 )

      SET COLOR TO W+/R

      nRow := Row()
      nCol := Col()

      FOR n := 0 TO 50
         @ nRow, nCol SAY n
         Inkey(0.1)
         nRow ++

         IF nRow > nBottom
            Scroll( nTop, nLeft, nBottom, nRight, 1 )
            nRow := nBottom
         ENDIF
      NEXT

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe