Qbasicnews.com

Full Version: simplest possible scrolling
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please, can you show me the simplest possible example of scrolling up-down in a text program (by arrow keys)? I can't seem to understand tutorials.
This should be pretty easy to figure out... Just play around with it.

Smile

Code:
DEFINT A-Z
SCREEN 13

DIM Array(1 TO 223) AS STRING

FOR A = 1 TO 223
Array(A) = CHR$(A + 32)
NEXT


DO
In$ = INKEY$
IF In$ = "8" THEN StartPosition = StartPosition - 1
IF In$ = "2" THEN StartPosition = StartPosition + 1

IF StartPosition > 200 THEN StartPosition = 200
IF StartPosition < 0 THEN StartPosition = 0

FOR T = 1 TO 23
  ArrayPosition = StartPosition + T
  LOCATE T, 1
  PRINT LTRIM$(STR$(ArrayPosition)); SPACE$(1); STRING$(5, Array(ArrayPosition)); SPACE$(5)
NEXT

LOOP