Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Incongruence between PRINT; and LOCATE+ PRINT; on the 25th row of Screen 0
#5
Note the very subtle change I've made to your code and run the following:

Code: (Select All)

_Title "Incongruence of behaviour of  25th line of text in SCREEN 0 using PRINT;"
While s$ <> "Q"
    Locate 1, 1
    Print "Please choose 1 to test PRINT; mode " + Chr$(13) + "and 2 to test LOCATE & PRINT; mode" + Chr$(13) + "press q to quit program demonstration"
    s$ = UCase$(InKey$)
    If s$ = "1" Then
        GoSub PrintMode1
    ElseIf s$ = "2" Then
        GoSub PrintMode2
    End If
Wend
End

PrintMode1:
Cls
For a% = 1 To 24
    If a% = 25 Then Print a%; Else Print a%
    _Delay .2
Next a%
Sleep 2
Cls
Return

PrintMode2:
Cls
For a% = 1 To 25
    Locate a%, 1
    Print a%;
    _Delay .2
Next a%
Sleep 2
Cls
Return


Now, if you look at your first FOR loop, I changed that to only print 24 numbers and not 25.
Run it and look closely at what happens to your screen....

If you're at the bottom TWO rows (24 or 25) and PRINT, the screen scrolls up!

With your code, you're printing the numbers 1 to 23 on the screen.
Then on 24, you're printing 24 and scrolling the screen up a line to see 2 to 24 on the screen.
Then on 25, you're printing 25 with a semicolon at the end, which prevents the screen scrolling so you're now seeing 2 to 25 on the screen.

It's not on the last line that you're seeing something odd; it's the natural result of printing on EITHER of the  last two rows and not ending your print statement with a semicolon to prevent the screen scrolling.

It's the exact same behavior as all the way back to GW basic, IIRC, and is certainly the same behavior that QB45 has.



Now, with that said, there's also some crappy old legacy method to print on those lines and suddenly change your font from font 16 to font 8, which then gives you 50 lines to text to deal with and not 25.   That's intentional as well, as off as that seems to.  A lot of this old behavior is just based on the legacy behavior of QB45 and how it performed in the past, so that we can stay compatible with old code.

My suggestion for an easy fix?  Just swap over to _PrintString or _UPrintString and then you won't have that issue to deal with, with screen scrolling, no matter where you print on your screen.
Reply


Messages In This Thread
RE: Incongruence between PRINT; and LOCATE+ PRINT; on the 25th row of Screen 0 - by SMcNeill - 11-25-2024, 09:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)