Microsoft KB Archive/89675

{| = FoxPro Sample Code Demonstrates Usage of SCROLL Command =
 * width="100%"|

ID: Q89675

2.00 2.50 2.50a | 2.50 2.50a

MS-DOS         | WINDOWS 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 , ,  [, ]

Scrolls an area of the screen or a window. ,  Scrolling occurs within a rectangular region of the screen or  window. The upper-left corner of the region is , the lower-right corner is .  Specifies the number of rows by which the area inside the rectangular region is scrolled vertically. If  is positive, the area is scrolled upward; if  is negative, the area is  scrolled downward. If  is zero and  is not included, the area is cleared.  Specifies the number of columns by which the area inside the rectangular region is scrolled horizontally. If  is  positive, the area is scrolled to the right; if  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.

Sample Code


*:        System: FoxPro 2.0 SCROLL example 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 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 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
 * }