1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00
QB64-PE/internal/help/CSRLIN.txt

52 lines
1.7 KiB
Plaintext
Raw Normal View History

2017-10-10 14:55:21 +00:00
The [[CSRLIN]] function returns the current text row position of the [[PRINT]] cursor.
2017-10-10 14:55:21 +00:00
{{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.
2017-10-10 14:55:21 +00:00
** 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.
2017-10-10 14:55:21 +00:00
{{PageExamples}}
''Example:'' A semicolon stops the print cursor immediately after the print.
{{CodeStart}} '' ''
2019-04-15 01:15:33 +00:00
LOCATE 5, 5: PRINT "HELLO ";
Y = {{Cl|CSRLIN}} 'save the row
X = {{Cl|POS}}(0) 'save the column
2019-04-15 01:15:33 +00:00
LOCATE 10, 10: PRINT "WORLD"
LOCATE Y, X 'restore saved position
2019-04-15 01:15:33 +00:00
PRINT "GOODBYE" '' ''
{{CodeEnd}}
{{OutputStart}}
HELLO GOODBYE
WORLD
{{OutputEnd}}
2019-04-15 01:15:33 +00:00
:''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.
2017-10-10 14:55:21 +00:00
{{PageSeeAlso}}
* [[SCREEN]], [[LOCATE]], [[POS]]
* [[_PRINTSTRING]] (graphic print)
2019-04-15 01:15:33 +00:00
{{PageNavigation}}
<