Hi Bill,

This is what I use, written in mvBase. I think all that would need to be
changed for U2 would be the "IN CH.VAL" be changed to "CH.VAL = SEQ(IN())"
but have never tried it in U2...

This routine allows the person to use the backspace, and will instantly
abort if they hit the ESC key or type in .QUIT which is their 'get me out of
here' standard.

The client really liked it :-)

hth,

Allen E. Elwood
www.tortillafc.com
Quality Code Since 1978


  SUBROUTINE SUB.ENTER.PASSWORD(SUCCESS,PWORD,ROW,COLUMN,PASSCOUNT)
  * Written Allen E. Elwood 08/19/05
  * Will return a one in SUCCESS if password entered matches password in
PWORD
  * ROW and COLUMN determine the beginning of the phrase "Enter Password : "
  * Set PASSCOUNT to the maximum number of tries before aborting
  *
  EQU BACKSPACE       TO 8
  EQU CARRIAGE.RETURN TO 13
  EQU ESC             TO 27
  EQU SMALLEST        TO 31
  EQU BIGGEST         TO 127
  ECHO OFF
  *
  SAVE.COLUMN = COLUMN
  PCOUNT = 0
  STARTC = COLUMN
  LOOP
    PVAL   = ""
    MSG    = 'Enter Password : '
    OFFSET = LEN(MSG)
    COLUMN = STARTC
    CRT @( COLUMN, ROW ):@(-3):MSG:
    LOOP
  *   Bring in the ascii value of the character typed
      IN CH.VAL
      CH.IN = CHAR(CH.VAL)
      IF CH.VAL = ESC THEN
        ESC.ENTERED = 1
        EXIT
      END ELSE
        ESC.ENTERED = 0
      END
      IF CH.VAL = CARRIAGE.RETURN THEN
        EXIT
      END
      IF CH.VAL>SMALLEST AND CH.VAL<BIGGEST THEN
        COLUMN+=1
        CRT '*':
        PVAL:=CH.IN
      END
      IF CH.VAL = BACKSPACE THEN
        IF COLUMN > STARTC THEN
          COLUMN-=1
          PVAL = PVAL[1,LEN(PVAL)-1]
          CRT @(COLUMN+OFFSET, ROW):' '
          CRT @(COLUMN+OFFSET, ROW):
        END
      END
    REPEAT
    CRT ''
    IF (ESC.ENTERED) OR (PVAL = '.QUIT') THEN
      SUCCESS = 0
      ECHO ON
      COLUMN = SAVE.COLUMN
      RETURN
    END
    IF PVAL = PWORD THEN
      SUCCESS = 1
    END ELSE
      SUCCESS = 0
    END
    IF SUCCESS = 1 THEN EXIT
    PCOUNT += 1
    IF PCOUNT = PASSCOUNT THEN
      CRT 'You have exceeded the maximum number of tries!':CHAR(7)
      SLEEP 3
      EXIT
    END
    CRT 'Invalid Password, try again!':CHAR(7)
    SLEEP 3
  REPEAT
  ECHO ON
  COLUMN = SAVE.COLUMN
  RETURN

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Brutzman, Bill
Sent: Tuesday, August 08, 2006 07:55
To: u2-users@listserver.u2ug.org
Subject: [U2] Input Mask


With an "input" statement, prompting from the keyboard, I cannot remember
how to show *** when a user is entering a password.

Suggestions would be appreciated.

--Bill
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to