Re: View Print 1/

 BBS: Inland Empire Archive
Date: 04-15-92 (19:18)             Number: 171
From: MICHAEL MALLEY               Refer#: NONE
  To: MANUEL GODINEZ                Recvd: NO  
Subj: Re: View Print        1/       Conf: (2) Quik_Bas
MG>MM> MG>allow me to use the ANSI.SYS with QB but have it to scroll
MG>MM> MG>when it gets to line 25 so I can put there the status bar

MG>Sure, can you post it or where can I get it ??

Hello Manuel,
The following code will show you how to manage horizontal and vertical
scrolling in text mode.  You will need to replace the print routine with
the one that you are using to handle ANSI codes.  You will also have to
keep track of what is going on as far as the ANSI cursor movement.  For
these reasons, I would suggest writing your own ANSI driver for use
within the application.  This would increase the value of your program
as most users choose not to load ANSI.SYS as it is a memory hog and
doesn't do anything for them with applications that don't support it.

- Michael

Hello all!  Here is the modified code allowing vertical as well as
horizontal virtual screen scrolls in text mode.  I'm sorry it has taken
so long to finish it, but in between all the great arguements we've been
having, and this wonderful cold of mine, I've been feeling kind of
drugged out.  There is one underscore character in the declaration for
Interrupt.  It must be deleted and the next line appended to the line
that the underscore in on.  You must load QB/QBX with the /L option on
the command line.  Please note that the Home and End keys no longer take
you to the beginning/end of the current line.  They are now used to
scroll diagonally along with PgUp and PgDn.  PgUp and End do not appear
to do anything when used, this is due to the fact that the characters
being viewed have been given a "/" type of slant.  In fact the
characters are being scrolled, you just can't notice it.  Have fun!  :)

- Michael -

 ------------------------[ VIRTUAL.BAS ]-------------------------------
DECLARE SUB Scroll (Row1%, Col1%, Row2%, Col2%, Lines%, attr%)
DEFINT A-Z

'-- We need the following type and declaration for accessing the BIOS scroll
'   screen function

TYPE RegType
     ax    AS INTEGER
     bx    AS INTEGER
     cx    AS INTEGER
     dx    AS INTEGER
     bp    AS INTEGER
     si    AS INTEGER
     di    AS INTEGER
     flags AS INTEGER
END TYPE

DECLARE SUB Interrupt (intnum AS INTEGER, Inreg AS RegType, outreg AS_
 RegType)


'-- You need to have an array containing the text for the screen
'   If we diminsion it as string, that will allow for variable
'   lengths without wasting memory.  We are going to use ASCII
'   codes of 32 to 255 as our virtual text.
DIM Text(1 TO 224) AS STRING

TopLine = 1         'Pointer shows what element is the top line
NumberOfLines = 23  'Number of rows to show at one time. This could be
                    'hard coded
CurrentCol = 1      'What "column" to start at in the element

COLOR 7, 0
CLS
LOCATE , , 0   'Turn off the cursor

'Let's make some stuff to show on the screen
Text(1) = SPACE$(224)
FOR Counter = 32 TO 255
  MID$(Text(1), Counter - 31) = CHR$(Counter)
NEXT Counter

Offset = 2
FOR Counter = 2 TO 224
  Text(Counter) = SPACE$(224)

  MID$(Text(Counter), 1) = MID$(Text(1), Offset)
  NextPosition = 225 - (Offset - 1)
  MID$(Text(Counter), NextPosition) = LEFT$(Text(1), (Offset - 1))
  Offset = Offset + 1
NEXT Counter

GOSUB ShowScreen

DO
  WHILE LEN(INKEY$): WEND 'Clear keyboard buffer
  DO
    KeyStroke$ = INKEY$
  LOOP UNTIL LEN(KeyStroke$)

  IF LEN(KeyStroke$) = 2 THEN
    SELECT CASE ASC(RIGHT$(KeyStroke$, 1))
      CASE 72 'Up
        TopLine = TopLine - 1
        IF TopLine THEN
          Scroll 2, 1, 24, 80, -1, 7
          LOCATE 2, 1
          PRINT MID$(Text(TopLine), CurrentCol, 80);
        ELSE
          TopLine = 1
        END IF

      CASE 80 'Down
        TopLine = TopLine + 1
        IF TopLine < 203 THEN
          Scroll 2, 1, 24, 80, 1, 7
          LOCATE 24, 1
          PRINT MID$(Text(TopLine + 22), CurrentCol, 80);
        ELSE
          TopLine = 202
        END IF

      CASE 75 'Left
        CurrentCol = CurrentCol - 1
        IF CurrentCol THEN
            GOSUB ShowScreen
        ELSE
            CurrentCol = 1
        END IF

      CASE 77 'Right
        CurrentCol = CurrentCol + 1
        IF CurrentCol < 146 THEN
            GOSUB ShowScreen
        ELSE
            CurrentCol = 145
        END IF

      CASE 71 'Home
        CurrentCol = CurrentCol - 1
        IF CurrentCol THEN
          TopLine = TopLine - 1
          IF TopLine THEN
            GOSUB ShowScreen
          ELSE
            TopLine = 1
          END IF
        ELSE
          CurrentCol = 1
        END IF
>>> Continued to next message

 * SLMR 2.1a * Real men *do* cry...

--- Maximus 2.01wb
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