FoxPro Sample Code Demonstrates Usage of SCROLL Command

Last reviewed: April 29, 1996
Article ID: Q89675
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

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: kbprg kbcode
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.