Silent pw entry not working
#16
@Ra7eN

To just tweak it a little for backspace, and leave the door open for other tweaks, like arrow keys, home/end, etc...

Code: (Select All)
PRINT "-Enter Password: ";: pInput$ = silentInput$

PRINT pInput$ 'DEBUG DELETE AFTER TESTING

FUNCTION silentInput$
    DIM Txt$
    DIM KeyPress$
    Txt$ = ""
    ' GREAT FOR PASSWORDS
    '------------------------------------------------------------------------------------------------
    pw = 1 ' Zero to show keyboard typing or 1 to show only asterisks.
    start_column = POS(0)
    y = CSRLIN: x = POS(0) ' Initial cursor position.
    DO
        _LIMIT 30
        KeyPress$ = INKEY$
        IF LEN(KeyPress$) THEN
            string_position = POS(0) - start_column ' Track cursor and word position.
            SELECT CASE KeyPress$
                CASE CHR$(27) ' Esc key.
                    SYSTEM
                CASE CHR$(13) ' Enter key.
                    EXIT DO
                CASE CHR$(8) ' Backspace key.
                    IF string_position > 0 THEN
                        Txt$ = MID$(Txt$, 1, string_position - 1) + MID$(Txt$, string_position + 1)
                        LOCATE , start_column: PRINT SPACE$(LEN(Txt$) + 1);
                        LOCATE , start_column
                        IF pw THEN PRINT STRING$(LEN(Txt$), "*"); ELSE PRINT Txt$;
                        LOCATE , x - 1
                    END IF
                CASE CHR$(32) TO "z"
                    IF pw THEN PRINT "*"; ELSE PRINT KeyPress$;
                    Txt$ = Txt$ + KeyPress$
            END SELECT
            y = CSRLIN: x = POS(0) ' Track cursor.
        END IF
    LOOP
    '------------------------------------------------------------------------------------------------
    PRINT
    silentInput$ = Txt$
END FUNCTION

Pete
Reply


Messages In This Thread
Silent pw entry not working - by Ra7eN - 12-11-2022, 02:06 PM
RE: Silent pw entry not working - by NasaCow - 12-11-2022, 02:30 PM
RE: Silent pw entry not working - by Ra7eN - 12-11-2022, 02:33 PM
RE: Silent pw entry not working - by Pete - 12-11-2022, 03:29 PM
RE: Silent pw entry not working - by mnrvovrfc - 12-11-2022, 03:44 PM
RE: Silent pw entry not working - by Pete - 12-11-2022, 05:03 PM
RE: Silent pw entry not working - by Ra7eN - 12-11-2022, 05:49 PM
RE: Silent pw entry not working - by Ra7eN - 12-11-2022, 05:47 PM
RE: Silent pw entry not working - by Pete - 12-11-2022, 06:01 PM
RE: Silent pw entry not working - by RhoSigma - 12-11-2022, 09:21 PM
RE: Silent pw entry not working - by mnrvovrfc - 12-11-2022, 09:33 PM
RE: Silent pw entry not working - by Pete - 12-11-2022, 11:28 PM
RE: Silent pw entry not working - by SMcNeill - 12-11-2022, 11:57 PM
RE: Silent pw entry not working - by Pete - 12-12-2022, 12:26 AM
RE: Silent pw entry not working - by SMcNeill - 12-12-2022, 12:42 AM
RE: Silent pw entry not working - by Pete - 12-12-2022, 01:53 AM
RE: Silent pw entry not working - by SMcNeill - 12-12-2022, 02:04 AM
RE: Silent pw entry not working - by Pete - 12-12-2022, 02:57 AM
RE: Silent pw entry not working - by Ra7eN - 12-12-2022, 03:17 AM
RE: Silent pw entry not working - by Ra7eN - 12-12-2022, 03:22 AM
RE: Silent pw entry not working - by bplus - 12-12-2022, 03:37 AM
RE: Silent pw entry not working - by Pete - 12-12-2022, 03:44 AM
RE: Silent pw entry not working - by Ra7eN - 12-12-2022, 05:18 AM
RE: Silent pw entry not working - by Pete - 12-12-2022, 06:13 AM
RE: Silent pw entry not working - by vince - 12-12-2022, 06:25 AM
RE: Silent pw entry not working - by SMcNeill - 12-12-2022, 06:54 AM
RE: Silent pw entry not working - by mnrvovrfc - 12-12-2022, 08:37 AM
RE: Silent pw entry not working - by Pete - 12-12-2022, 06:58 AM
RE: Silent pw entry not working - by vince - 12-12-2022, 05:47 PM
RE: Silent pw entry not working - by Pete - 12-12-2022, 06:27 PM
RE: Silent pw entry not working - by Pete - 12-13-2022, 02:02 AM
RE: Silent pw entry not working - by Pete - 12-13-2022, 02:04 AM
RE: Silent pw entry not working - by vince - 12-13-2022, 02:12 AM
RE: Silent pw entry not working - by Pete - 12-13-2022, 02:21 AM
RE: Silent pw entry not working - by SMcNeill - 12-13-2022, 09:12 AM
RE: Silent pw entry not working - by Pete - 12-13-2022, 10:29 AM
RE: Silent pw entry not working - by mnrvovrfc - 12-13-2022, 12:19 PM
RE: Silent pw entry not working - by mnrvovrfc - 12-13-2022, 11:10 AM
RE: Silent pw entry not working - by Ra7eN - 12-14-2022, 10:24 PM
RE: Silent pw entry not working - by Ra7eN - 12-14-2022, 10:26 PM
RE: Silent pw entry not working - by SMcNeill - 12-14-2022, 11:24 PM
RE: Silent pw entry not working - by Ra7eN - 12-15-2022, 12:41 AM
RE: Silent pw entry not working - by Pete - 12-21-2022, 12:32 AM
RE: Silent pw entry not working - by bplus - 12-21-2022, 04:51 PM
RE: Silent pw entry not working - by Pete - 12-21-2022, 05:14 PM
RE: Silent pw entry not working - by bplus - 12-21-2022, 05:27 PM



Users browsing this thread: 15 Guest(s)