qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
LOCATE Statement, CSRLIN, POS Functions
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
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.
 
LOCATE  [row%] [,[column%] [,[cursor%] [,start% [,stop%]]]]
CSRLIN
POS(expression)
 
    ■ 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"