home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a054 / 1.img / GETLIB.EXE / GETPASS.PRG < prev    next >
Encoding:
Text File  |  1992-03-09  |  1.3 KB  |  53 lines

  1. // GetPass.prg
  2. //
  3. // Get reader for passwords
  4.  
  5. #include "GetExit.ch"
  6. #include "Inkey.ch"
  7.  
  8. proc GetPassword( oGet )
  9.  
  10. LOCAL nKey,              ;
  11.       nChar,             ;
  12.       cKey
  13.  
  14.   // read the GET if the WHEN condition is satisfied
  15.   IF ( GetPreValidate(oGet) )
  16.     // activate the GET for reading
  17.     oGet:SetFocus()
  18.  
  19.     oGet:cargo := ""
  20.     DO WHILE ( oGet:exitState == GE_NOEXIT )
  21.       // check for initial typeout (no editable positions)
  22.       IF ( oGet:typeOut )
  23.         oGet:exitState := GE_ENTER
  24.       ENDIF
  25.  
  26.       // apply keystrokes until exit
  27.       DO WHILE ( oGet:exitState == GE_NOEXIT )
  28.         nKey := InKey(0)
  29.         IF nKey >= 32 .AND. nKey <= 255
  30.           oGet:cargo += Chr(nKey)
  31.           GetApplyKey(oGet, Asc("*"))
  32.            ELSEIF nKey == K_BS 
  33.           oGet:cargo := Substr(oGet:cargo, 1, Len(oGet:cargo) - 1)
  34.       GetapplyKey(oGet, nKey)
  35.         ELSEIF nKey == K_ENTER
  36.       GetApplyKey(oGet, nKey)
  37.     ENDIF
  38.       ENDDO
  39.  
  40.       // disallow exit if the VALID condition is not satisfied
  41.       IF ( !GetPostValidate(oGet) )
  42.         oGet:exitState := GE_NOEXIT
  43.       ENDIF
  44.     ENDDO
  45.     // de-activate the GET
  46.     oGet:KillFocus()
  47.   ENDIF
  48.   IF oGet:exitState != GE_ESCAPE
  49.     oGet:varPut(oGet:cargo)
  50.   ENDIF
  51.  
  52. RETURN
  53.