'Generic "simple" input routine.
'Posted in QuickBASIC Fido Conference by Robert Kennedy
'Converted (and enhanced) to PowerBASIC by Dave Navarro, Jr.
DEFINT A-Z
PRINT "Enter Your Name: ";
GetInput N$, 40
PRINT "Hi! "; N$
SUB GetInput( Default$, BYVAL MaxLength ) PUBLIC
Row = CSRLIN 'use the current cursor position
Col = POS ' to mimic INPUT.
CharCount = LEN(Default$)
DO
LOCATE Row, Col, 1 'be sure to turn the cursor on
PRINT Default$;
DO
C$ = INKEY$
LOOP UNTIL LEN(C$)
SELECT CASE C$
CASE CHR$(8)
IF CharCount > 0 THEN 'If more than zero characters, delete one
DECR CharCount
Default$ = LEFT$( Default$, LEN( Default$ ) - 1 )
LOCATE Row, Col, 0
PRINT Default$;" ";
END IF
CASE CHR$(13) 'Return was pressed so end loop.
EXIT LOOP
CASE ELSE
IF (ASCII(C$)>31) AND (LEN(Default$) * Origin: Nitelog BBS Monterey CA (408) 655-1096 (1:216/303) (1:216/303)
|