Philip,
Using INKEY() does not matter provided that SET CURSOR ON is issued after password entry.
The sample code below uses INKEY() but CURSOR is ON (No need to issue SET CURSOR ON after password entry). This module works fine on all our FP 2.x projects
Note: This function exits upon entering Enter Key OR Esc
function getpass
parameter ncol,nrow
ccode = ""
@ncol,nrow say ""
mm = 400
do while .t.
nkey = inkey(0)
set bell to mm,3
if (nkey >= 65 and nkey <= 90) or (nkey >= 97 and nkey <= 122) or ;
(nkey >= 48 and nkey <= 57) or nkey == 27 or nkey = 32
ccode = ccode + upper(chr(nkey))
?? "*" && Display Asterisk
STORE mm+50 TO mm
else
if nkey = 127 and len(alltrim(ccode)) > 0
ccode = substr(ccode,1,len(ccode)-1)
@ ROW(),COL()-1.0 SAY ' '
@ ROW(),COL()-1.0 SAY ''
STORE mm-50 TO mm
endif
endif
if lastkey() = 27
exit
endif
if (nkey = 13 and len(ccode) > 0) or len(ccode) = 16
if len(ccode) = 16
ccode = substr(ccode,1,16)
endif
exit
endif
enddo
password = ccode
return password
How to use it?
mypassword = GETPASS(10,20) && where 10,20 starting row and col respectively.
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net
CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."