Alternatively, to allow the user to enter a password but
have the keys typed when entering the password show up as
asterisks on the screen try the following piece of code.
FUNCTION PASSWORD
PARAMETER Y_COORD, X_COORD, M.WIDTH, M.COLOUR
PRIVATE M.EXIT, M.ENTRY, M.KEY
STORE IIF(EMPTY(M.WIDTH),16,M.WIDTH) TO M.WIDTH
STORE IIF(EMPTY(M.COLOUR),'w+/n',M.COLOUR) TO M.COLOUR
STORE '' TO M.ENTRY
STORE .F. TO EXIT
DO WHILE .NOT. M.EXIT
@ Y_COORD, X_COORD SAY SPACE(M.WIDTH) COLOR (M.COLOUR)
@ Y_COORD, X_COORD SAY REPLICATE('*',LEN(M.ENTRY)) COLOR (M.COLOUR)
M.KEY = INKEY(0)
DO CASE
CASE M.KEY=27
STORE '' TO M.ENTRY
STORE .T. TO M.EXIT
CASE M.KEY=13
STORE .T. TO M.EXIT
CASE M.KEY=127 .AND. LEN(M.ENTRY)>0
M.ENTRY = LEFT(M.ENTRY,LEN(M.ENTRY)-1)
CASE M.KEY>=48 .AND. LEN(M.ENTRY)<M.WIDTH
M.ENTRY = M.ENTRY+CHR(M.KEY)
OTHERWISE
? CHR(7)
ENDCASE
ENDDO
RETURN M.ENTRY
Put the above code into a dummy program and precede the
function call with:-
mypassword = password(10,10)
The password entered on screen will show as asterisks but
the value of mypassword will show as what was entered.
HTH.