Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW DO I HIDE PASSWORD FIELD ENTRY ON A SCREEN? 1

Status
Not open for further replies.

MIZPAM

Programmer
Jan 11, 2001
9
US
WHAT IS THE PICTURE CODE?
 
clear
set talk off
set safe off
set conf on
store space(10) to pass_word
set colo to /n
@3,5 say 'Enter Password :' get pass_word size 1,10
read
set colo to
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top