Prezados
- Estou com duvida Cruel.
- Como faço num campo senha , na hora da informação exibir o * ?
Grato
:-o
Moderador: Moderadores
WSENHA := ;
GetSecret( WSENHA, 11, 14, .T., )
PROCEDURE Main
LOCAL cPassword := Space(20)
CLS
SET CONFIRM ON
cPassWord := ;
GetSecret( cPassword, 10, 10, .T., "Enter your password: ")
IF cPassWord <> "xHarbour"
Alert( "Access denied" )
QUIT
ENDIF
Alert( "Access granted" )
RETURN
LOCAL nKey, ;
nChar, ;
cKey
// read the GET if the WHEN condition is satisfied
IF ( GetPreValidate(oGet) )
// activate the GET for reading
oGet:SetFocus()
oGet:cargo := ""
DO WHILE ( oGet:exitState == GE_NOEXIT )
// check for initial typeout (no editable positions)
IF ( oGet:typeOut )
oGet:exitState := GE_ENTER
ENDIF
// apply keystrokes until exit
DO WHILE ( oGet:exitState == GE_NOEXIT )
nKey := InKey(0)
IF nKey >= 32 .AND. nKey <= 255
oGet:cargo += Chr(nKey)
GetApplyKey(oGet, Asc("*"))
ELSEIF nKey == K_BS
oGet:cargo := Substr(oGet:cargo, 1, Len(oGet:cargo) - 1)
GetapplyKey(oGet, nKey)
ELSEIF nKey == K_ENTER
GetApplyKey(oGet, nKey)
ENDIF
ENDDO
// disallow exit if the VALID condition is not satisfied
IF ( !GetPostValidate(oGet) )
oGet:exitState := GE_NOEXIT
ENDIF
ENDDO
// de-activate the GET
oGet:KillFocus()
ENDIF
IF oGet:exitState != GE_ESCAPE
oGet:varPut(oGet:cargo)
ENDIF
cText := Pad( cText, 20 )
cText := Pad( cText, nLen )
JoséQuintas escreveu:Será que precisa mesmo ser na getsys?
Veja se interessa:
https://github.com/JoseQuintas/JoseQuintas/blob/master/source/ze_getsecret.prg
<input type="password" id="senha" name="xsenha"
FUNCTION GETSEN(P1)
LOCAL L2, L3, L4
IF GETPREVALIDATE(P1)
P1:SETFOCUS()
P1:CARGO := ""
DO WHILE P1:EXITSTATE() == 0
IF P1:TYPEOUT()
P1:EXITSTATE := 5
ENDIF
DO WHILE P1:EXITSTATE() == 0
L2 := Inkey(0)
IF L2 >= 32 .AND. L2 <= 255
P1:CARGO := P1:CARGO() + CHR(L2)
GetApplyKey(P1, 42) // NOME COMPLETO
ELSEIF L2 = 8
P1:CARGO := SUBSTR(P1:CARGO(), 1, LEN(P1:CARGO()) - 1)
GetApplyKey(P1, L2) // NOME COMPLETO
ELSEIF L2 = 13 // Sai com tecla ENTER e retorna a
// senha digitada
GetApplyKey(P1, L2) // NOME COMPLETO
ELSEIF L2 = 27 // Sai com Tecla ESC e retorna vazio
GetApplyKey(P1, L2) // NOME COMPLETO
ENDIF
ENDDO
IF .NOT. GETPOSTVALIDATE(P1) // NOME COMPLETO
P1:EXITSTATE := 0
ENDIF
ENDDO
P1:KILLFOCUS()
ENDIF
IF P1:EXITSTATE() <> 7
P1:VARPUT(P1:CARGO())
ENDIF
RETURN
É que no GetSys vc pode navegar pelos campos, caso vc esteja Getando vários campos e um deles seja a Senha.
Mas a tua função está ótima.
Usuários vendo este fórum: Nenhum usuário registrado online e 10 visitantes