Function Scroll() Foundation

Scrolls up, down, right, or left in a screen area.

Syntax
Scroll( [<nTop>], [<nLeft>], [<nBottom>], [<nRight>], ;
        [<nRows>], [<nColumns>] )  --> NIL
Parameters
<nTop>
<nTop> is an integer numeric value specifying the top screen row for the area to scroll. The four arguments <nTop>, <nLeft>, <nBottom> and <nRight> determine the screen coordinates for the scroll area.
<nLeft>
<nLeft> is an integer numeric value specifying the left screen column for the scroll area.
<nBottom>
<nBottom> is an integer numeric value specifying the bottom screen row for the scroll area.
<nRight>
<nRight> is an integer numeric value specifying the right screen column for the scroll area.
<nRows>
<nRows> specifies the number of rows to scroll vertically. The scroll direction is determined by the sign of <nRows>.
Scrolling Vertically
Value for <nRows> scrolls
less than 0 <nRows> rows are scrolled down
exactly 0 rows are not scrolled vertically
greater than 0 <nRows> rows are scrolled up
NIL when no value for <nRows> and <nColumns> is indicated, the entire screen area is scrolled (equivalent to the command @..CLEAR TO)
<nColumns>
<nColumns> determines the number of columns scrolled horizontally. The scroll direction is determined by the sign of <nColumns>.
Scrolling Horizontally
value for <nColumns> scrolls
less than 0 <nColumns> columns are scrolled right
exactly 0 columns are not scrolled horizontally
greater than 0 <nColumns> columns are scrolled left
NIL when no value for <nColumns> is indicated, the value 0 is used
Return

Scroll() always returns NIL.

Description

The screen function Scroll() scrolls a specified screen segment up, down, left or right. The scroll area must be defined within the range 0, 0 to MaxRow(), MaxCol(). When no coordinates are indicated, the entire screen in the area 0, 0 to MaxRow(), MaxCol() is scrolled.

To scroll the screen segment one row up, the top line of the segment is deleted, the remaining rows shift one position upward and a blank line is shown on the bottom row of the screen segment in the default color of the system color determined with SetColor(). Scrolling down, left or right occurs in a similar manner.

Scroll() is a powerful function whose possibilities reach from simple status messages to complex browse displays.

Examples
Vertical and horizontal scrolling

// The example displays the numbers 0 to 100 in a screen 
// segment bounded by DispBox(). With the numbers up 
// to 30 scrolling is vertical when the output occurs 
// beyond the bottom row of the output area. The numbers 
// > 30 fill the output area to the right boundary, then 
// scrolling is horizontal. 
// Note the three color values for DispBox(), SAY and Scroll(). 

PROCEDURE Main 
   LOCAL nRow, nCol, n 

   CLS 
   DispBox(6,10,17,60,1,"W+/B")       // box in bright white on blue 
   nRow := Row() 
   nCol := Col() 

   SetColor("W+/G")                   // scroll in green 

   FOR n := 0 TO 100                  // output numbers 
                                      // 0 to 100 
      @ nRow, nCol SAY n COLOR "W+/R" // display in red 
      Inkey(.1) 

      nRow ++ 
      IF nRow > 16 

         IF n < 30                    // vertical scrolling 
            Scroll( 7,11,16,59, 1 )   // to n==30 
            nRow := 16 
         ELSE 

            IF nCol+20 > 59           // horizontal scrolling 
               Scroll( 7,11,16,59, 0, 10 ) 
            ELSE                      // as soon as display 
               nCol+=10               // no longer fits in box 
            ENDIF 
            nRow:= 7 

         ENDIF 
      ENDIF 
   NEXT 

RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.