CSRLIN: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "The CSRLIN function returns the current text row position of the PRINT cursor. {{PageSyntax}} : {{Parameter|row%}} = CSRLIN {{PageDescription}} * The value returned is within the range of 1 to the current number of rows in the SCREEN mode used. ** In SCREEN 0 (text mode), the _HEIGHT function returns the number of text rows. ** In graphic modes, the number of available text rows can be calculated by dividing _HEIGHT (measured in pixels i...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
The [[CSRLIN]] function returns the current text row position of the [[PRINT]] cursor. | The [[CSRLIN]] function returns the current text row position of the [[PRINT]] cursor. | ||
Line 17: | Line 16: | ||
{{PageExamples}} | {{PageExamples}} | ||
''Example:'' A semicolon stops the print cursor immediately after the print. | ''Example:'' A semicolon stops the print cursor immediately after the print. | ||
{{CodeStart}} | {{CodeStart}} | ||
LOCATE 5, 5: PRINT "HELLO "; | LOCATE 5, 5: PRINT "HELLO "; | ||
Y = {{Cl|CSRLIN}} 'save the row | Y = {{Cl|CSRLIN}} 'save the row | ||
X = {{Cl|POS}}(0) 'save the column | X = {{Cl|POS}}(0) 'save the column | ||
LOCATE 10, 10: PRINT "WORLD" | LOCATE 10, 10: PRINT "WORLD" | ||
LOCATE Y, X 'restore saved position | LOCATE Y, X 'restore saved position | ||
PRINT "GOODBYE" | PRINT "GOODBYE" | ||
{{CodeEnd}} | {{CodeEnd}} | ||
Latest revision as of 00:25, 29 January 2023
The CSRLIN function returns the current text row position of the PRINT cursor.
Syntax
- row% = CSRLIN
Description
- The value returned is within the range of 1 to the current number of rows in the SCREEN mode used.
- In SCREEN 0 (text mode), the _HEIGHT function returns the number of text rows.
- In graphic modes, the number of available text rows can be calculated by dividing _HEIGHT (measured in pixels in graphic modes) by _FONTHEIGHT: totalRows% = _HEIGHT / _FONTHEIGHT
- In screen modes that support page flipping, the CSRLIN function returns the vertical coordinate of the cursor on the active page.
- x = POS(0) returns the column location of the cursor.
Examples
Example: A semicolon stops the print cursor immediately after the print.
LOCATE 5, 5: PRINT "HELLO "; Y = CSRLIN 'save the row X = POS(0) 'save the column LOCATE 10, 10: PRINT "WORLD" LOCATE Y, X 'restore saved position PRINT "GOODBYE" |
HELLO GOODBYE WORLD |
- Explanation: "HELLO " is printed and the semicolon stops the cursor immediately after the text. The CSRLIN variable records the current print cursor's text row in Y. The POS function records the current print cursor's text column in X. The second PRINT statement displays the comment "WORLD" on the 10th line of the screen. The last LOCATE statement restores the position of the cursor to the original line and column immediately after the first print.
See also
- SCREEN, LOCATE, POS
- _PRINTSTRING (graphic print)