Czemu to nie działa ??

0

Czemu to mi nie działa dla Edita:

if not Key in '0'..'9' then key := '';

Jak wpisuje w OnChange to wywala:
"[Error] Unit1.pas(29): Undeclared identifier: 'Key'"
A jak wpisuje w OnKeyPress to:
"[Error] Unit1.pas(28): Operator not applicable to this operand type"
Albo jak wpisuje w OnKeyDown:
"[Error] Unit1.pas(30): Operator not applicable to this operand type"

Co jest nie tak?
Pomóżcie jak możecie :)
Pozdrio all {hello}

0

wsadz ten kod do wątku on key down!!!!!!!!!!!!!!!!!

0

aha sorry - juz npisales ze tam występuję błąd := key:= nie wolno!!!!!

0

Adrian16/ napisał:
Czemu to mi nie działa dla Edita:
&gt
&gtif not Key in '0'..'9' then key := '';
&gt
&gtJak wpisuje w OnChange to wywala:
&gt"[Error] Unit1.pas(29): Undeclared identifier: 'Key'"
&gtA jak wpisuje w OnKeyPress to:
&gt"[Error] Unit1.pas(28): Operator not applicable to this operand type"
&gtAlbo jak wpisuje w OnKeyDown:
&gt"[Error] Unit1.pas(30): Operator not applicable to this operand type"
&gt
&gtCo jest nie tak?
&gtPomóżcie jak możecie :)
&gtPozdrio all {hello}

Tak mi zadziałało:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if not Key in [0..9] then key := 0;
end;

piechnat

0

a jezeli tobie nie działo to spróbuj

if not [0..9] in Key then key := 0; //moze bedzie działało :P

0

Najlepiej to powinno być :

if Key in ['1'..'9'] then ... else ....

0

Tak ma byc:
if not (Key in ['0'..'9']) then key := #0;

3 bledy byly!--Pawel {Delphi6 }

Po pierwsze: F1

1 użytkowników online, w tym zalogowanych: 0, gości: 1