PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 25 → WX - Como fazer máscara de campo no Webdev? (Field mask in Webdev/Masque de champ dans Webdev)
WX - Como fazer máscara de campo no Webdev? (Field mask in Webdev/Masque de champ dans Webdev)
Iniciado por Boller, mai., 08 2021 3:58 AM - 5 respostas
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em maio, 08 2021 - 3:58 AM
Boa noite!!!

Prezados,

Para fazer máscara de campo no Webdev segue abaixo exemplo:

PROCEDURE mascaraTelefone(sTelefone is string):string
sTel is string = sTelefone

sTel = StringInsert(sTel, "(", 1)
sTel = StringInsert(sTel, ")", 4)

IF Length(sTel) = 13 THEN
sTel = StringInsert(sTel, "-", 10)
ELSE
sTel = StringInsert(sTel, "-", 9)
END

RESULT sTel




PROCEDURE mascaraTelefoneEdicao(sComponente is string)

nKey is int = 0x08

IF NOT KeyPressed(nKey) OR
Length({sComponente, indControl}) = 13 THEN

IF Length({sComponente, indControl}) = 1 THEN
{sComponente, indControl} = StringInsert({sComponente, indControl}, "(", 1)
ELSE
IF Length({sComponente, indControl}) = 3 THEN
{sComponente, indControl} = StringInsert({sComponente, indControl}, ")", 4)
END
END

IF Length({sComponente, indControl}) > 8 THEN
sValor is string = Replace({sComponente, indControl}, ["(", ")", "-" ], "")
{sComponente, indControl} = mascaraTelefone(sValor)
END

{sComponente, indControl}..Cursor = Length({sComponente, indControl}) + 1
END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em maio, 08 2021 - 4:31 AM








--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em maio, 08 2021 - 4:34 AM
Essa postsgem é em homenagem ao Mario Oliveura
um dos ultimos pedidos dele feuto para mim.
Agradeço pelo exemplo ao Felipe
que gentilmente enviou o exemplo

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em maio, 08 2021 - 4:36 AM
PROCEDURE mascara_cnpj(s_recebe_cnpj is string)
IF s_recebe_cnpj <>"" THEN
s_recebe_cnpj = s_recebe_cnpj[[1 TO 2]] + "." + ...
s_recebe_cnpj[[3 TO 5]] + "." + ...
s_recebe_cnpj[[6 TO 8]] + "/" + ...
s_recebe_cnpj[[9 TO 12]] + "-" + ...
s_recebe_cnpj[[13 TO 14]]
END
-------
mascara_cnpj(cnpj)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em maio, 08 2021 - 4:36 AM
PROCEDURE mascara_cnpj(s_recebe_cnpj is string)
*cnpj is string = (val(s_recebe_cnpj)>0?Rigth("00000000000000"+s_Recebe_cnpj, 14) else s_recebe_cnpj)*
IF cnpj <>"" THEN
cnpj = cnpj[[1 TO 2]] + "." + ...
cnpj[[3 TO 5]] + "." + ...
cnpj[[6 TO 8]] + "/" + ...
cnpj[[9 TO 12]] + "-" + ...
cnpj[[13 TO 14]]
END
s_recebe_cnpj = cnpj
-------
mascara_cnpj(cnpj)

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.655 mensagems
Popularité : +175 (223 votes)
Publicado em junho, 21 2021 - 9:54 PM
Máscara para campo telefone no Windev

sCRegEx is string = "(([0-9]{2,3})|\([0-9]{2,3}\))[-. ]*(([0-9]{4,5})[-. ]*([0-9]{4}))$"
IF RegexMatch(MySelf,sCRegEx) = False THEN
Info("Numero de telefone inválido")
ReturnToCapture(MySelf)
END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/