Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Password character
Message
De
14/02/2002 10:48:36
 
 
À
14/02/2002 06:24:47
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00619907
Message ID:
00620057
Vues:
17
This is one that I used in fpw2.6
FUNCTION hideword
PARAMETERS a_row,a_col,a_len
*---------------------------------------------------------------------
*Allows for input of a string of specified length at a specified
*screen location. displays "*" for each keystroke and returns the
*text string for keys entered.
PRIVATE a_word,mexit,ret_cursor
ret_cursor = SET("CURSOR")
SET MESSAGE TO "Enter Password"
IF TYPE("A_ROW") <> "N"
 a_row=8.200
ENDIF
IF TYPE("A_COL") <> "N"
 a_col=31.850
ENDIF
IF TYPE("A_LEN") <> "N"
 a_len=14
ENDIF
STORE SPACE(0) TO a_word
@ a_row,a_col SAY REPLICATE(" ",a_len*1) ;
 FONT "Foxfont", 9 ;
 STYLE "B" ;
 COLOR RGB(,,,,,)
mexit = .T.
@ a_row-.1,a_col-.5 TO a_row+1.1,a_col+(a_len*1.8)+1
DO WHILE .T.
 SET CURSOR ON
 @ a_row,a_col-.3 CLEAR TO a_row+1,a_col+(a_len*1.6)+.8
 @ a_row,a_col  SAY REPLICATE("*",LEN(a_word));
  FONT "Foxfont", 9 ;
  STYLE "B" ;
  COLOR RGB(,,,,,)
 aa=INKEY(0,"M")
 SET CURSOR OFF
 DO CASE
 CASE aa  = 9  &&tab key was pressed
  EXIT
 CASE aa = 151 &&mouse click
  EXIT
 CASE  aa  = 127 .AND. LEN(a_word) >0  &&BACKSPACE KEY WAS PRESSED
  a_word = SUBSTR(a_word,1,LEN(a_word)-1)
 CASE aa = 28 &&F1 key was pressed
 CASE aa = 13 .OR. LEN(a_word) > a_len-1
  EXIT
 CASE aa = 27
  EXIT
 CASE  aa <> 127 .AND. aa > 31
  a_word = a_word+UPPER(CHR(aa))
 ENDCASE
ENDDO
SET MESSAGE TO
SET CURSOR &ret_cursor
RETURN a_word
It converts all input on screen to * and returns upper(password). If you want case sensitive, remove upper() from a_word+UPPER(CHR(aa)).
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform