*... PASSPROC.PRG ...
*... This routine waits for alpha-numeric input,
*... displays '*'s at x/y coords, then
*... returns a character string of 'nlength'
PARAMETERS nlength, nxpos, nypos
IF TYPE('nLength') = 'L'
nlength = 1
ENDIF
IF TYPE('nXpos') = 'L'
nxpos = 0
ENDIF
IF TYPE('nYpos') = 'L'
nypos = 0
ENDIF
*CLEAR
STORE .F. TO done
STORE 0 TO nKeyCode, nttllen
STORE '' TO cPassword
DO WHILE nKeyCode # 27
nKeyCode = INKEY(0, 'HM')
DO CASE
*... numpad 0-1 if numlock is off
CASE INLIST(nKeyCode, 22, 6, 24, 3, 19, 4, 1, 5, 18)
do caution with "NumLock Off", "Check NumLock"
*... number
CASE INLIST(nKeyCode, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57)
IF nttllen = nlength
loop
*done = .T.
ENDIF
nttllen = nttllen + 1
cPassword = cPassword + CHR(nKeyCode)
*... lower alpha
CASE BETWEEN(nKeyCode, 97, 122)
IF nttllen = nlength
loop
*done = .T.
ENDIF
nttllen = nttllen + 1
cPassword = cPassword + CHR(nKeyCode)
*... upper alpha
CASE BETWEEN(nKeyCode, 65, 90)
IF nttllen = nlength
loop
*done = .T.
ENDIF
nttllen = nttllen + 1
cPassword = cPassword + CHR(nKeyCode)
*... backspace
CASE nKeyCode = 127
nttllen = nttllen - 1
cPassword = LEFT(cPassword, nttllen)
IF nttllen < 1
nttllen = 0
ENDIF
CASE nKeyCode = 27 &&... escape
cPassword = ''
done = .T.
* CASE nKeyCode = 9 &&... tab
* done = .T.
CASE nKeyCode = 13 &&... enter
done = .T.
ENDCASE
@ nxpos, nypos SAY PADR(REPLICATE('*', nttllen), nlength, ' ') FONT 'Foxfont', 10
IF nttllen = nlength
EXIT
ENDIF
IF done
EXIT
ENDIF
ENDDO
RETURN cPassword
*......... caution dialog .....
PROCEDURE caution
PARAMETERS cautitle, msgstring
PUSH KEY
ON KEY LABEL f2 *
ON KEY LABEL f3 *
IF NOT WEXIST("caution")
DEFINE WINDOW caution ;
AT 19.167, 15.000 ;
SIZE 7.308,95.000 ;
TITLE '*** ' + cautitle + ' ***';
FONT "MS Sans Serif", 8 ;
FLOAT ;
NOCLOSE ;
MINIMIZE ;
SYSTEM ;
COLOR RGB(,,,255,0,0)
ENDIF ( NOT WEXIST("caution") )
MOVE WINDOW caution CENTER
IF WVISIBLE("caution")
ACTIVATE WINDOW caution SAME
ELSE
ACTIVATE WINDOW caution NOSHOW
ENDIF ( WVISIBLE("caution") )
STORE WCOLS("caution")/2 TO wincenter
STORE LEN(msgstring)/2 TO mcenter
STORE 0 TO nothing
@1, (wincenter - mcenter) - 2 SAY msgstring;
COLOR RGB(0,0,0,255,255,0);
FONT "MS Sans Serif", 9 ;
STYLE "B"
@ 2.769, (wincenter - 4.3) GET nothing ;
PICTURE "@*HT \<Ok" ;
SIZE 1.769,8.667,0.667 ;
FONT "MS Sans Serif", 8 ;
STYLE "B"
READ CYCLE
CLEAR
DEACTIVATE WINDOW caution
RELEASE WINDOW caution
POP KEY
RETURN