11-25-2024, 06:16 PM
Hi friends
here I discovered again hot water!!!
here the experience about PRINT in SCREEN 0 (standard 80 columns and 25 rows of text)
Be calm QB64pe duplicates QB4.5 and Qbasic in this behaviour , so the issue comes from the far past of Qbasic.
run the code and enjoy the experience:
I repeat that this code (adapted to Qbasic : no instructions _delay and _Title) gives the same result in Qbasic under Dosbox!
Well you can see how you can print on the 25th row (the last at the bottom) without going ahead only if you use LOCATE before PRINT ; otherwise you go ahead also if you use PRINT; and you don't go over the 80 characters for row!
Why this information is useful?
in a Q&A
Question: How to print on the last row of text without going ahead?
Answer: You must use Locate Lastrow, Column: Print SomethingToPrint; (Be care that Lastcolumn - Column >=LEN(SomeThingToPrint)) [example LOCATE 25,10: PRINT "SomethingLessThanLastColumn" REM 80-10 >= LEN( "SomethingLessThanLastColumn") --> 70>=27
here I discovered again hot water!!!
here the experience about PRINT in SCREEN 0 (standard 80 columns and 25 rows of text)
Be calm QB64pe duplicates QB4.5 and Qbasic in this behaviour , so the issue comes from the far past of Qbasic.
run the code and enjoy the experience:
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 25
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
I repeat that this code (adapted to Qbasic : no instructions _delay and _Title) gives the same result in Qbasic under Dosbox!
Well you can see how you can print on the 25th row (the last at the bottom) without going ahead only if you use LOCATE before PRINT ; otherwise you go ahead also if you use PRINT; and you don't go over the 80 characters for row!
Why this information is useful?
in a Q&A
Question: How to print on the last row of text without going ahead?
Answer: You must use Locate Lastrow, Column: Print SomethingToPrint; (Be care that Lastcolumn - Column >=LEN(SomeThingToPrint)) [example LOCATE 25,10: PRINT "SomethingLessThanLastColumn" REM 80-10 >= LEN( "SomethingLessThanLastColumn") --> 70>=27