FoxPro Sample Code Demonstrates Usage of SCROLL Command

ID: Q89675

2.00 2.50 2.50a | 2.50 2.50a

MS-DOS          | WINDOWS

The information in this article applies to:

SUMMARY

The text below contains a Microsoft FoxPro application that demonstrates using the SCROLL command. The application creates a box on the screen. The user can change the data in the box using the arrow keys and the HOME, END, PAGE UP, and PAGE DOWN keys.

The syntax of the SCROLL command is as follows:

SCROLL <row1, col1>, <row2, col2>, <expN1> [, <expN2>]

   Scrolls an area of the screen or a window.

<row1, col1>, <row2, col2>

   Scrolling occurs within a rectangular region of the screen or
   window. The upper-left corner of the region is <row1, col1>, the
   lower-right corner is <row2, col2>.

<expN1>

   Specifies the number of rows by which the area inside the
   rectangular region is scrolled vertically. If <expN1> is positive,
   the area is scrolled upward; if <expN1> is negative, the area is
   scrolled downward. If <expN1> is zero and <expN2> is not included,
   the area is cleared.

<expN2>

   Specifies the number of columns by which the area inside the
   rectangular region is scrolled horizontally. If <expN2> is
   positive, the area is scrolled to the right; if <expN2> is
   negative, the area is scrolled to the left. If both <expN1> and
   <expN2> are included, the area may be scrolled diagonally.

Example

   SCROLL 0, 0, 5, 5, -2, 1

   Scrolls the upper-left 6 rows and 6 columns down by 2 rows and
   to the right by 1 column.

MORE INFORMATION

Sample Code

*:*****************************************************************

*:         System: FoxPro 2.0 SCROLL example
*:***************************************************************** SET COLOR OF SCHEME 1 TO W+/B CLEAR @ 4,4 SAY 'Loading BRSCROLL.PRG please wait...' CLEAR ALL CLOSE ALL ON KEY SET SAFETY OFF SET TALK OFF SET STATUS OFF CLEAR SET COLOR OF SCHEME 1 TO W+/BG @ 00,00 SAY SPACE(80) string='FoxPro 2.0 SCROLL example' @ 00,(80-LEN(string))/2 SAY string @ 24,00 SAY SPACE(80) @ 24,02 SAY 'Press: Arrow keys, Pgup, PgDn, Home, End' @ 24,55 SAY 'Enter or Escape to Quit'

SET COLOR OF SCHEME 1 TO W+/BR @ 07,28,10,51 BOX @ 08,29 SAY 'Test of Scroll Command' @ 09,29 SAY 'Test of Scroll Command'

SET CURSOR OFF SET COLOR OF SCHEME 1 TO W+/B

DO WHILE .T.

   =INKEY(0)
   DO CASE
   CASE LASTKEY()=27 or LASTKEY()=13   && Escape or Enter
      CLEAR
      SET CURSOR ON
      RETURN
   CASE LASTKEY()=5                    && Up arrow
      SCROLL 1,0,23,79,1
   CASE LASTKEY()=24                   && Down arrow
      SCROLL 1,0,23,79,-1
   CASE LASTKEY()=4                    && Right arrow
      SCROLL 1,0,23,79,0,1
   CASE LASTKEY()=19                   && Left arrow
      SCROLL 1,0,23,79,0,-1
   CASE LASTKEY()=1                    && Home
      SCROLL 1,0,23,79,1,-1
   CASE LASTKEY()=6                    && End
      SCROLL 1,0,23,79,-1,-1
   CASE LASTKEY()=18                   && Page Up
      SCROLL 1,0,23,79,1,1
   CASE LASTKEY()=3                    && Page Down
      SCROLL 1,0,23,79,-1,1
   ENDCASE
ENDDO while .t.

Additional reference words: FoxDos FoxWin 2.00 scroll scrol move window 2.50 2.50a KBCategory: KBSubcategory: FxprgGeneral

Keywords          : kbcode FxprgGeneral 
Version           : 2.00 2.50 2.50a | 2.50 2.50a
Platform          : MS-DOS WINDOWS

Last Reviewed: May 22, 1998