After a person enters a user ID, I use a function to handle entering passwords.
Try this...
@ 5, 7 say 'Enter ID:' ;
get User_ID ;
picture '@!'
read
if ( lastkey() != K_ESC )
@ 7, 7 say 'Password:'
get_pswd( 7, 17, PassWord, '*' )
endif
You can change the last parameter to whatever character you wish to display instead of letters of the password.
function get_pswd ( therow, thecol, thepass, character )
local maxlen := len( thepass ) ,;
thelength := 1 ,;
thepos := 0 ,;
thenew, thekey
@ therow, thecol say NULL
thecol--
setcursor( SC_BLOCK )
do while ( TRUE )
if ( ( thekey := inkey( 0 ) ) == K_ENTER OR ;
thekey == K_ESC OR ;
thekey == K_UP )
exit
elseif ( thekey == K_DELETE ) // delete
if ( thelength > thepos )
loop
endif
@ therow, thecol + thepos say ' '
thenew := len( thepass ) - thelength + 1
thepass := stuff( thepass, thelength, thenew, right( thepass, thenew - 1 ) + ' ')
thepos--
elseif ( thekey == BACKSPACE ) // backspace
if ( thelength == 1 )
loop
endif
@ therow, thecol + thepos say ' '
thenew := len( thepass ) - thelength + 2
thepass := stuff( thepass, --thelength, thenew, right( thepass, thenew - 1 ) + ' ' )
thepos--
elseif ( thekey == K_RIGHT )
if ( thelength = maxlen OR thelength > thepos )
loop
else
thelength++
endif
elseif ( thekey == LEFTARROW ) // left artherow
if ( thelength == 1 )
loop
else
thelength--
endif
elseif ( thekey < 32 OR thekey > 126 ) // invalid entry
badbeep()
loop
else
@ therow, thecol + thelength say character
if ( thelength > thepos )
thepos := thelength
endif
thepass := stuff( thepass, thelength, 1, chr( thekey ) )
if ( thelength == 12 )
exit
endif
thelength++
endif
@ therow, thecol + thelength say NULL
enddo
thepass := upper( thepass )
return ( TRUE )