Moves the text cursor to a specific location on the screen.
LOCATE row, column
Remarks and Examples
When text is written to the screen, characters are positioned on a grid. The screen has a width of 80 columns (numbered 1 through 80, left-to-right), and a height of 25 rows (numbered 1 through 25, top-to-bottom).
100 CLS 110 LOCATE 20, 5 120 INPUT "Please enter your name: ", N$ 130 N$ = LEFT$(N$, 24) : REM If the name is over 24 characters long, shorten it to 24 characters 130 FOR X% = 1 TO LEN(N$) 140 LOCATE 25 - X%, 80 - X% 150 PRINT MID$(N$, X%, 1); 160 NEXT X% 170 X$ = GETCHAR$ : REM Wait for the user to press a key
An error will be generated if the specified column is less than 1 or greater than 80, or if the specified row is less than 1 or greater than 25.
Writing a character to the lower-right corner character position on the screen (row 25, column 80) will cause the screen to scroll up one line.
Note: The "row, column" or (y, x) order of specifying coordinates may seem backwards, as the graphics commands use the more traditional order of (x, y). The "row, column" order for the LOCATE command was chosen for compatibility with Microsoft's BASIC dialects (QuickBASIC, Qbasic, GW-BASIC).
Copyright 2006-2012, Kevin Matz, All Rights Reserved.