home *** CD-ROM | disk | FTP | other *** search
- // GetPass.prg
- //
- // Get reader for passwords
-
- #include "GetExit.ch"
- #include "Inkey.ch"
-
- proc GetPassword( oGet )
-
- LOCAL nKey, ;
- nChar, ;
- cKey
-
- // read the GET if the WHEN condition is satisfied
- IF ( GetPreValidate(oGet) )
- // activate the GET for reading
- oGet:SetFocus()
-
- oGet:cargo := ""
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- // check for initial typeout (no editable positions)
- IF ( oGet:typeOut )
- oGet:exitState := GE_ENTER
- ENDIF
-
- // apply keystrokes until exit
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- nKey := InKey(0)
- IF nKey >= 32 .AND. nKey <= 255
- oGet:cargo += Chr(nKey)
- GetApplyKey(oGet, Asc("*"))
- ELSEIF nKey == K_BS
- oGet:cargo := Substr(oGet:cargo, 1, Len(oGet:cargo) - 1)
- GetapplyKey(oGet, nKey)
- ELSEIF nKey == K_ENTER
- GetApplyKey(oGet, nKey)
- ENDIF
- ENDDO
-
- // disallow exit if the VALID condition is not satisfied
- IF ( !GetPostValidate(oGet) )
- oGet:exitState := GE_NOEXIT
- ENDIF
- ENDDO
- // de-activate the GET
- oGet:KillFocus()
- ENDIF
- IF oGet:exitState != GE_ESCAPE
- oGet:varPut(oGet:cargo)
- ENDIF
-
- RETURN