Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling Output That Exceeds Screen Size
#13
(04-08-2024, 09:28 PM)Tim Wrote: I have been trying to figure out how to do this, scroll program output when it fills more than one screenful , but I have had no luck so far. I am currently working on Lesson 4 of Terry's Tutorial. Some example programs, as well as my own experiments, use a lot more screen length than just one. For example, one of the example programs counts to 100 (from whatever starting point you give it); I would like to be able to see all of the output from it (as well as the results of my own hacks, which I do in order to make sure I can replicate and understand creatively what the lesson(s) teach).
I'm not sure if this would help, but here's a simple method I use for displaying long instructions for my QB64 games: 

Code: (Select All)
Sub ShowInstructions
    Dim in$: in$ = GetInstructions$
    Dim iLoop As Integer
    Dim iCount As Integer: iCount = 0
    Dim iRows As Integer: iRows = _Height(0) \ _FontHeight ' GET # OF AVAILABLE TEXT ROWS
    ReDim arrLines(-1) As String
    Cls
    split in$, Chr$(13), arrLines() ' SPLIT OUTPUT INTO LINES
    For iLoop = LBound(arrLines) To UBound(arrLines)
        ' WHEN MAX LINES ARE DISPLAYED, PAUSE AND WAIT FOR USER TO PRESS <ENTER>
        If arrLines(iLoop) <> Chr$(10) Then
            Print arrLines(iLoop)
            iCount = iCount + 1
            If iCount > (iRows - 5) Then
                Input "PRESS <ENTER> TO CONTINUE"; in$
                iCount = 0
            End If
        Else
            ' Chr$(10) MEANS PAUSE, WAIT FOR USER, RESET LINE COUNTER
            Input "PRESS <ENTER> TO CONTINUE"; in$
            iCount = 0
        End If
    Next iLoop
    Input "PRESS <ENTER> TO CONTINUE"; in$
End Sub ' ShowInstructions

' /////////////////////////////////////////////////////////////////////////////
' NOTE: Chr$(10) causes ShowInstructions to pause and wait for the user
' to press <ENTER>.

Function GetInstructions$
    Dim in$
    in$ = in$ + "my text here" + Chr$(13)
    in$ = in$ + " " + Chr$(13)
    in$ = in$ + "more text" + Chr$(13)
    in$ = in$ + "etc. etc." + Chr$(13)
    in$ = in$ + Chr$(10) + Chr$(13)' pause here

    in$ = in$ + "another section" + Chr$(13)
    in$ = in$ + "etc." + Chr$(13)
   
    GetInstructions$ = in$
End Function ' GetInstructions$
It keeps track of the text rows printed to the screen, and when it exceeds the vertical resolution, it prompts the user to press ENTER to continue, and also lets you designate pauses manually (for example at the end of a given topic). 

Good Luck!
Reply


Messages In This Thread
RE: Scrolling Output That Exceeds Screen Size - by madscijr - 04-09-2024, 05:12 PM



Users browsing this thread: 3 Guest(s)