SCROLLER(<N top row>, <N left col>, <N bottom row>, <N right col>, <N lines>, <C "up" or "down">)
Scrolls within a specified area on the screen, or clears a window quickly.

<lines> is the number of lines to scroll (0 clears the entire window)
"U" or "u" = scroll up, "D" or "d" = scroll down.

Zero <lines> clears the entire specified area, and other values "scroll"
the screen to provide you with blank lines on which you may display the
appropriate "next" entry or entries.

The scrolling color attribute is determined by the current
cursor position when SCROLLER() is called.

* Example window displays eight records, and assumes there
* are always at least eight records in the database file.
* Scrolling is one record at a time.

* Set up parameters.
num_lines = 8 && number of lines in window
t_row = 7 && top row of window
b_row = 14 && bottom row of window
l_col = 30 && left column of window
r_col = 50 && right column of window
direction = "D" && initial direction to scroll is down

* Open file.
USE Datafile && can be indexed or not

* Paint window full of records.
i = 1
DO WHILE i <= num_lines .AND. .NOT. EOF()
@ (t_row-1)+i, l_col SAY Field
SKIP
i = i+1
ENDDO

* Position pointer at first record.
GO TOP

* Loop for window display according to user keypress.
DO WHILE .T.
key = INKEY()
DO CASE
CASE key = 18 .AND. .NOT. BOF() && PgUp
IF direction = "D"
SKIP -1
IF BOF()
* Still at record one, no skip necessary.
LOOP
ENDIF
ELSE
SKIP -num_lines
ENDIF
direction = "D"
row = t_row
CASE key = 3 .AND. .NOT. EOF() && PgDn
IF direction = "U"
SKIP 1
IF EOF()
SKIP -1 && recovery from EOF (not necessary with BOF)
LOOP
ENDIF
ELSE
SKIP num_lines
ENDIF
direction = "U" && move down = scroll up
row = b_row
CASE key = 27 && Escape key to exit
USE && close files when done
RETURN
OTHERWISE
LOOP
ENDCASE

* Scroll and repaint.
SCROLLER( t_row, l_col, b_row, r_col, 1, direction )
@ row, l_col SAY Field
ENDDO


Placed in the Public Domain by Tom Rettig Assoc.