Autor Beitrag
1_of_1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5
BeitragVerfasst: So 18.06.06 14:18 
Ich möchte bei Tastendruck abfragen, ob eine Zahl gedrückt wurde, oder nicht. Sollte dies nicht der Fall gewesen sein, soll keine Eingabe erfolgen. Wieso funktioniert das hier nicht?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in [#8,#48..#57])
   then
   Key := #0;
end;
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 18.06.06 14:25 
Hast du dir den Ablauf im Debugger angesehen?

_________________
Markus Kinzler.
1_of_1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5
BeitragVerfasst: So 18.06.06 14:31 
:?: :?: :?:
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: So 18.06.06 14:39 
ausblenden Delphi-Quelltext
1:
Form1.KeyPreview := True;					

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
1_of_1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5
BeitragVerfasst: Mo 19.06.06 05:00 
OK, Danke!
Habe jetzt die Prozedur einfach beim jeweiligen Edit-Feld eingebaut. Funktioniert so auch.