QBasic 1.1: LOCATE Statement
Explanation
LOCATE Statement, CSRLIN, POS Functions
LOCATE moves the cursor to a specified position on the screen.
CSRLIN returns the current row position of the cursor.
POS returns the current column position of the cursor.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
LOCATE [row%] [,[column%] [,[cursor%] [,start% [,stop%]]]] |
CSRLIN |
POS(expression) |
Description / Parameter(s)
row% and column% |
The number of the row and column to which the cursor moves. |
cursor% |
Specifies whether the cursor is visible: 0 = invisible, 1 = visible |
start% and stop% |
Integer expressions in the range 0 through 31 that specify the first and last cursor scan lines. You can change the cursor size by changing the cursor scan lines. |
expression |
Any expression. |
Example
CLS
LOCATE 5, 5
MyRow% = CSRLIN
MyCol% = POS(0)
PRINT "Position 1 (Press any key)"
DO
LOOP WHILE INKEY$ = ""
LOCATE (MyRow% + 2), (MyCol% + 2)
PRINT "Position 2"