Re: INKEY ???

 BBS: Inland Empire Archive
Date: 02-05-93 (18:39)             Number: 346
From: BOB PERKINS                  Refer#: NONE
  To: ERIC MAYS                     Recvd: NO  
Subj: Re: INKEY ???                  Conf: (2) Quik_Bas
 EM> does anyone know how the inkey oe inkey$ works if:
 EM> you are trying to write an unbreak(ctrl-c proof) security program...
 EM> The input statements are all strings here is an Example..
 EM> print "Enter id"
 EM> input users$

  Here's a quickie I threw together.  Ctrl-C won't get out
of this one.  Supports the backspace key and you could
modify it to support the END/HOME/DEL/INS keys.

  DECLARE FUNCTION getentry$ (row%, column%, length%)

  t$ = getentry$(10, 10, 20)
  PRINT : PRINT "Input was "; CHR$(34); t$; CHR$(34); "."

  FUNCTION getentry$ (row%, column%, length%)
  LOCATE row%, column%, 1    'position cursor and switch on..
  a$ = INKEY$
   IF a$ = CHR$(13) THEN EXIT DO   'carriage return ends input
   IF a$ = CHR$(8) THEN
     a$ = ""
     IF LEN(text$) THEN
       text$ = LEFT$(text$, LEN(text$) - 1)
       LOCATE row%, column%: PRINT SPACE$(length%);
       LOCATE row%, column%: PRINT text$;
     END IF
   IF LEN(a$) > 0 AND LEN(text$) < length% THEN
     text$ = text$ + a$
     PRINT a$;
  getentry$ = text$

--- Msg V4.5
 * Origin: Reciprocity Failure  (1:124/4115.236)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET