POS: 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 '''POS''' function returns the current print cursor text column position. {{PageSyntax}} :: column% = POS(0) * The value in parenthesis is normally 0, but any numerical value or variable could be used for compatibility with Basic. * When a semicolon ends the previous PRINT statement the cursor column position will be after the last character printed. * If TAB or a comma is used the column position will be immediately after the tabbed position normally 9 spac...") |
No edit summary |
||
Line 14: | Line 14: | ||
''Example:'' Column positions after prints. | ''Example:'' Column positions after prints. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|PRINT}} {{Cl|POS}}(0) 'column position always starts on 1 at top of new or after {{Cl|CLS}} | {{Cl|PRINT}} {{Cl|POS}}(0) 'column position always starts on 1 at top of new or after {{Cl|CLS}} | ||
{{Cl|PRINT}} "hello"; 'column position is 6 on same row immediately after text | {{Cl|PRINT}} "hello"; 'column position is 6 on same row immediately after text | ||
Line 23: | Line 23: | ||
{{Cl|PRINT}} 'start new row | {{Cl|PRINT}} 'start new row | ||
{{Cl|PRINT}} | {{Cl|PRINT}} | ||
{{Cl|PRINT}} {{Cl|POS}}(0) ' column position is 1 on next row | {{Cl|PRINT}} {{Cl|POS}}(0) ' column position is 1 on next row | ||
{{CodeEnd}} | {{CodeEnd}} | ||
''Note:'' Column tab prints may not always move 9 spaces past the center of the screen. Some may move text to next row. | ''Note:'' Column tab prints may not always move 9 spaces past the center of the screen. Some may move text to next row. | ||
''See also:'' | ''See also:'' | ||
* [[CSRLIN]], [[LOCATE]], [[PRINT]] | * [[CSRLIN]], [[LOCATE]], [[PRINT]] | ||
* [[_PRINTSTRING]] {{text|(graphic position print)}} | * [[_PRINTSTRING]] {{text|(graphic position print)}} |
Revision as of 02:21, 23 January 2023
The POS function returns the current print cursor text column position.
Syntax
- column% = POS(0)
- The value in parenthesis is normally 0, but any numerical value or variable could be used for compatibility with Basic.
- When a semicolon ends the previous PRINT statement the cursor column position will be after the last character printed.
- If TAB or a comma is used the column position will be immediately after the tabbed position normally 9 spaces after text
- If a PRINT statement does not use a semicolon or comma at the end, the return value will be 1 on the next row.
- Column position returned can be saved to return to a previous print position later using LOCATE.
Example: Column positions after prints.
PRINT POS(0) 'column position always starts on 1 at top of new or after CLS PRINT "hello"; 'column position is 6 on same row immediately after text PRINT POS(0) PRINT 'start new row PRINT "hello", 'column position is 15 on same row (normally tabs 9 spaces) PRINT POS(0) PRINT 'start new row PRINT PRINT POS(0) ' column position is 1 on next row |
Note: Column tab prints may not always move 9 spaces past the center of the screen. Some may move text to next row.
See also:
- CSRLIN, LOCATE, PRINT
- _PRINTSTRING (graphic position print)