Fórum Verificar tecla pressionada no evento OnChange #340057
08/04/2007
0
2) Como faço para restringir as teclas prescionadas entre 0 e 9 e ¬ ?
Tentei o evento OnKeyDown e OnKeyPress porem o evento OnChange é executado antes.
Obrigado pela atenção.
Ullrich
Curtir tópico
+ 0Posts
09/04/2007
Robsonselzelin
Gostei + 0
09/04/2007
Prilady
Gostei + 0
09/04/2007
Ullrich
Estou Usando um TEdit
Gostei + 0
09/04/2007
Rjun
begin if not (key in [0..9, ´¬´]) then key := 0; end;
Gostei + 0
10/04/2007
Ullrich
if not (key in [0..9, ´¬´]) then
key := #0;
end;
O codigo funciona perfeitamente, o problema é que meu procedimento prescisa estar no evento OnChange, e o evento OnChange é chamado antes do evento OnKeyPress.
Eu presciso fazer a verificação da tecla dentro do OnChange, como faço isso ???
Obrigado pela atenção.
Gostei + 0
10/04/2007
Marco Salles
Acho que voce deve estar fazendo confusão
Alem disso não tem o not como voce inicialmente postou
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (key in [´0´..´9´,´¬´]) then
key := #0;
end;
Gostei + 0
11/04/2007
Ullrich
ta tudo certo no evento OnKeyPress ! !
Valeu as dicas.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)