CSRLIN

From QB64 Wiki
Revision as of 16:57, 31 August 2009 by 63.116.159.137 (talk) (Created page with ''''Purpose:''' To return the current line (row) position of the cursor. '''Syntax:''' y=CSRLIN '''Comments:''' y is a numeric variable receiving the value returned. The value r…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose: To return the current line (row) position of the cursor.

Syntax: y=CSRLIN

Comments: y is a numeric variable receiving the value returned. The value returned is within the range of 1 to the current number of lines on the screen.

The CSRLIN variable returns the vertical coordinate of the cursor on the active page (see the SCREEN statement).

x=POS(0) returns the column location of the cursor. The value returned is within the range of 1 to 40, or 1 to 80, depending on the current screen width (see the POS function).

Examples:

Y=CSRLIN
X=POS(0)
LOCATE 24, 1
PRINT "HELLO"
LOCATE Y, X

HELLO

The CSRLIN variable in line 10 records the current line.

The POS function in line 20 records the current column.

In line 40, the PRINT statement displays the comment "HELLO" on the 24th line of the screen.

The LOCATE statement in line 50 restores the position of the cursor to the original line and column.