SCROLL.BAS v2.0 2/3

 BBS: Inland Empire Archive
Date: 03-03-93 (20:11)             Number: 252
From: CHRIS TRACY                  Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: SCROLL.BAS v2.0 2/3            Conf: (2) Quik_Bas
'>>> Start of page 2.

'
' This source code is released into the public domain. You can use it in
' any of your programs for free, I don't care...
'
LOCATE , , 0                                      ' Turn the cursor OFF!
GOSUB Update:                                     ' This updates the+_
' list...
DO
        WHILE LEN(I$) = 0: I$ = INKEY$: WEND      ' Wait for a key
        SELECT CASE I$                            ' What was it?
        CASE CHR$(0) + "G"                        ' Must be HOME ...
                ElementToStart% = 0                    ' Reset starting
                Num = 0                                ' points and+_
' update
                GOSUB Update:                          ' the scroll
        CASE CHR$(0) + "O"                        ' Or maybe END ...
                ElementToStart% = Elements% - (Brw% - UpR%) ' set the+_
' start
                Num = Elements%                             ' point to+_
' the
                GOSUB Update:                         ' last ones &+_
' update
        CASE CHR$(0) + "Q"                        ' PGDN ...
                ElementToStart% = ElementToStart% + (Brw% - UpR%)
                IF ElementToStart% + (Brw% - UpR%) > Elements% THEN
                        Num = Elements% - (Brw% - UpR%)
                        ElementToStart% = Elements% - (Brw% - UpR%)
                END IF
                GOSUB Update:
                IF ElementToStart% <> 0 THEN
                        Num = Num + (Brw% - UpR%)
                END IF
        CASE CHR$(0) + "I"                        ' PGUP ...
                ElementToStart% = ElementToStart% - (Brw% - UpR%)
                IF ElementToStart% < 0 THEN
                        Num = 0
                        ElementToStart% = 0
                END IF
                GOSUB Update:
                IF ElementToStart% <> 0 THEN
                        Num = Num - (Brw% - UpR%)
                END IF
        CASE CHR$(0) + "P"                         ' Down arrow key
                ElementToStart% = ElementToStart% + 1
                IF ElementToStart% + (Brw% - UpR%) > Elements% THEN
                        ElementToStart% = ElementToStart% - 1
                        GOTO Repeat:
                END IF
                GOSUB Update:
                Num = Num + 1
        CASE CHR$(0) + "H"                         ' Up arrow key
                ElementToStart% = ElementToStart% - 1
                IF ElementToStart% < 0 THEN
                        ElementToStart% = ElementToStart% + 1
                        GOTO Repeat:
                END IF
                GOSUB Update:
                Num = Num - 1
        CASE EndCode$                              ' The ender key!
                GOTO Ender:
        END SELECT
Repeat:
        I$ = ""      ' This resets I$, which is what the WHILE..WEND_
' uses.
        LOOP
        GOTO Ender:  ' Something else must've happened...
Update:
        '
        ' Here comes the fun part
        '
        FOR Show = 0 TO Brw% - UpR%
                LOCATE UpR% + Show, LfC%  ' Get in the right place.
                COLOR Fore%, Back%        ' Make sure we have the right_
' color
                Prine$ = MID$(Arry$(ElementToStart% + Show), 1, Rgc% -_
 LfC%)
                ' The above is simply used so I wouldn't have as much
' code
                ' later on.
                j% = INSTR(Prine$, "&&")  ' Are there any color codes?
                IF j% THEN
                        DO WHILE j%
                                ColorChangeFore = VAL(MID$(Prine$, j% +_
 2, 2))
                                ' Gets the foreground color
                                ColorChangeBack = VAL(MID$(Prine$, j% +_
 4, 2))
                                ' Gets the background color
                                COLOR ColorChangeFore, ColorChangeBack
                                ' Change to that color
                                Prine$ = MID$(Prine$, j% + 6)
                                ' Take out that color code.
                                j% = INSTR(Prine$, "&&")
                                ' Any more color codes?
                                IF j% THEN
                                        PRINT MID$(Prine$, 1, j% - 1);
                                        ' If so, then just print up to
' the next code.

'>>> Continued on page 3.

--- T.A.G. 2.6d Standard
 * Origin: DangerBase ][ Programming Staff 412-438-4101 (1:2615/4@FIDONET.ORG)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET