VIEW PRINT: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "The VIEW PRINT statement defines the boundaries of a text viewport {{KW|PRINT}} area. {{PageSyntax}} : '''VIEW PRINT''' [{{Parameter|topRow%}} '''TO''' {{Parameter|bottomRow%}}] {{Parameters}} * {{Parameter|topRow%}} and {{Parameter|bottomRow%}} specify the upper and lower rows of the text viewport. * If {{Parameter|topRow%}} and {{Parameter|bottomRow%}} are not specified when first used, the text viewport is defined to be the entire screen. {{PageDescription}...")
 
No edit summary
Line 7: Line 7:


{{Parameters}}
{{Parameters}}
* {{Parameter|topRow%}} and {{Parameter|bottomRow%}} specify the upper and lower rows of the text viewport.  
* {{Parameter|topRow%}} and {{Parameter|bottomRow%}} specify the upper and lower rows of the text viewport.
* If {{Parameter|topRow%}} and {{Parameter|bottomRow%}} are not specified when first used, the text viewport is defined to be the entire screen.
* If {{Parameter|topRow%}} and {{Parameter|bottomRow%}} are not specified when first used, the text viewport is defined to be the entire screen.




{{PageDescription}}
{{PageDescription}}
* A second [[VIEW PRINT]] statement without parameters can also disable a viewport when no longer needed.
* A second [[VIEW PRINT]] statement without parameters can also disable a viewport when no longer needed.
* [[CLS]] or [[CLS|CLS 2]] statement will clear the active text viewport area only, and reset the cursor location to {{Parameter|topRow%}}.
* [[CLS]] or [[CLS|CLS 2]] statement will clear the active text viewport area only, and reset the cursor location to {{Parameter|topRow%}}.
* A {{KW|SCREEN}} mode change or {{KW|RUN}} statement can also clear and disable viewports.
* A {{KW|SCREEN}} mode change or {{KW|RUN}} statement can also clear and disable viewports.
Line 46: Line 46:
{{Cl|_DELAY}} 4
{{Cl|_DELAY}} 4
{{Cl|CLS}}
{{Cl|CLS}}
{{Cl|PRINT}} "Back to top left after CLS!" '' ''
{{Cl|PRINT}} "Back to top left after CLS!"
{{CodeEnd}}
{{CodeEnd}}
: ''Note:'' The bottom row of the VIEW PRINT port can be used only when located or prints end with semicolons.
: ''Note:'' The bottom row of the VIEW PRINT port can be used only when located or prints end with semicolons.

Revision as of 02:57, 23 January 2023

The VIEW PRINT statement defines the boundaries of a text viewport Template:KW area.


Syntax

VIEW PRINT [topRow% TO bottomRow%]


Template:Parameters

  • topRow% and bottomRow% specify the upper and lower rows of the text viewport.
  • If topRow% and bottomRow% are not specified when first used, the text viewport is defined to be the entire screen.


Description

  • A second VIEW PRINT statement without parameters can also disable a viewport when no longer needed.
  • CLS or CLS 2 statement will clear the active text viewport area only, and reset the cursor location to topRow%.
  • A Template:KW mode change or Template:KW statement can also clear and disable viewports.
  • After active viewport is disabled, normal screen printing and clearing can begin.
  • Row coordinates may vary when a WIDTH statement has been used.
  • Note: QB64 RUN statements will not close VIEW PRINT, VIEW or WINDOW view ports presently!


Example: Demonstrates how text scrolls within the text viewport.

' clear the entire screen and show the boundaries of the new text viewport
CLS
PRINT "Start at top..."
LOCATE 9, 1: PRINT "<- row 9 ->"
LOCATE 21, 1: PRINT "<- row 21 ->"

' define new text viewport boundaries
VIEW PRINT 10 TO 20

' print some text that will scroll the text viewport
FOR i = 1 TO 15
  PRINT "This is viewport line:"; i
  SLEEP 1
NEXT i

' clear only the active text viewport with CLS or CLS 2
CLS
PRINT "After clearing, the cursor location is reset to the top of the text viewport."

' disable the viewport
VIEW PRINT
_DELAY 4
LOCATE 20, 20: PRINT "Print anywhere after view port is disabled"
_DELAY 4
CLS
PRINT "Back to top left after CLS!"
Note: The bottom row of the VIEW PRINT port can be used only when located or prints end with semicolons.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link