What? It's not good enough!!! Okay, try this baby out...
Change pw = 0 to pw =1 to display asterisks.
Well, that's enough fun for me tonight. Have to go make tacos. Yum!
Change pw = 0 to pw =1 to display asterisks.
Code: (Select All)
' Single line keyboard routine for input. Excludes highlighting, cut, copy, paste.
LOCATE , 3, 1 ' Show cursor.
pw = 0 ' 1 sets "*" display on for password privacy, zero shows keyboard input.
mr = 11 ' Margin right.
start_column = POS(0)
y = CSRLIN: x = POS(0) ' Initial cursor position.
DO
_LIMIT 30
b$ = INKEY$
IF LEN(b$) THEN
string_pos = POS(0) - start_column ' Track cursor and word position.
SELECT CASE b$
CASE CHR$(27) ' Esc key.
SYSTEM
CASE CHR$(13) ' Enter key.
EXIT DO
CASE CHR$(8) ' Backspace key.
IF string_pos > 0 THEN GOSUB backspace
CASE CHR$(0) + "S" ' Delete key.
GOSUB delete
CASE CHR$(0) + "M" ' Arrow right key.
IF string_pos < LEN(word$) THEN GOSUB cursor_forward
CASE CHR$(0) + "K" ' Arrow left key.
IF string_pos > 0 THEN GOSUB cursor_back
CASE CHR$(0) + "G" ' Home
LOCATE , start_column
CASE CHR$(0) + "O" ' End
LOCATE , start_column - 1 + LEN(word$)
IF POS(0) < mr THEN LOCATE , POS(0) + 1
CASE CHR$(0) + "R" ' Insert/overwrite toggel
ovw = 1 - ovw
IF ovw = 0 THEN LOCATE , , 1, 7, 7 ELSE LOCATE , , 1, 7, 30
CASE CHR$(32) TO "z"
IF string_pos + start_column < mr THEN GOSUB print_chr
END SELECT
y = CSRLIN: x = POS(0) ' Track cursor.
END IF
LOOP
END
print_chr:
SELECT CASE ovw
CASE 0
IF start_column + LEN(word$) < mr THEN
word$ = MID$(word$, 1, string_pos) + b$ + MID$(word$, string_pos + 1)
LOCATE , start_column: PRINT SPACE$(LEN(word$) + 1);
LOCATE , start_column
IF pw THEN PRINT STRING$(LEN(word$), "*"); ELSE PRINT word$;
LOCATE , x + 1
END IF
CASE ELSE
word$ = MID$(word$, 1, string_pos) + b$ + MID$(word$, string_pos + 1)
IF pw THEN PRINT "*"; ELSE PRINT b$;
END SELECT
RETURN
backspace:
word$ = MID$(word$, 1, string_pos - 1) + MID$(word$, string_pos + 1)
LOCATE , start_column: PRINT SPACE$(LEN(word$) + 1);
LOCATE , start_column
IF pw THEN PRINT STRING$(LEN(word$), "*"); ELSE PRINT word$;
LOCATE , x - 1
RETURN
delete:
word$ = MID$(word$, 1, string_pos) + MID$(word$, string_pos + 2)
LOCATE , start_column: PRINT SPACE$(LEN(word$) + 1);
LOCATE , start_column
IF pw THEN PRINT STRING$(LEN(word$), "*"); ELSE PRINT word$;
LOCATE , x
RETURN
cursor_forward:
IF POS(0) < mr THEN LOCATE , POS(0) + 1
RETURN
cursor_back:
LOCATE , POS(0) - 1
RETURN
Well, that's enough fun for me tonight. Have to go make tacos. Yum!
If eggs are brain food, Biden takes his scrambled.