Autor Beitrag
LonghornUser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Do 04.08.05 13:04 
Hallo mal wieder,

ich habe mal eine Frage zu einem Editfeld. Und zwar möchte ich in dem keinerlei Zahlen erlauben.
Es muss auch nicht beim Edit bleiben, kann auch ne andere Komponente werden, aber wie macht man das ?
ich hab nach Suchen nur gefunden, wie man nur Zahlen erlaubt, aber das ist ja das gegenteil ;)

Danke schonmal.

ciao
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Do 04.08.05 13:07 
Mir fällt dazu nur ein, im OnChange den Text nach Zahlen durchzusuchen und wenn eine gefunden wird die rauslöschen...

Nicht elegant, aber auf Anhieb wüsst ich nix besseres

Gruß

noidic

_________________
Bravery calls my name in the sound of the wind in the night...
Kroni
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: Do 04.08.05 13:10 
mal ein kurzer gedanke^^
wenn du ne taste drückst, wenn der coursor im edit ist, und du ne taste drückst (die procedure dazu hat auch was mit drücken (auf englisch) zu tun ;-)
und wenn dann im edit ne taste gedrückt wird, und diese dann den wert einer zahl überliefert, einfach mal so tun, als ob die taste "nichts" gedrückt wird....

der obige beitratg tuts auch, ist aber nit so ellegant...weil du ja immer alles durchsuchen musst!
Grendel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 443

Gentoo Linux, MacOS X, Win 2000
D5 Ent, D7 Ent, Lazarus, Anjuta, MonoDevelop
BeitragVerfasst: Do 04.08.05 13:11 
Wie wäre es denn mit einem TMaskEdit?

Bis neulich ...
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 04.08.05 13:13 
user profile iconLonghornUser hat folgendes geschrieben:
ich hab nach Suchen nur gefunden, wie man nur Zahlen erlaubt, aber das ist ja das gegenteil ;)


ähm. und wo ist das Problem, das umzudrehen? :roll:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Do 04.08.05 13:15 
danke für die antworten.

Aber wie geht das mit einem Maskedit ?
rafi@work
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Do 04.08.05 13:32 
Hallo

Im OnKeyPress Event deines Editfeldes, kannst du folgendes schreiben:

ausblenden Delphi-Quelltext
1:
2:
if (Key in [#08, '0'..'9']) then
    Key := #0;


Somit werden alle Eingaben erlaubt, ausser Zahlen.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Do 04.08.05 13:48 
das funktioniert soweit, aber leider funktioniert dann Backspace nicht mehr.
Warum das ?
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 04.08.05 13:52 
user profile iconLonghornUser hat folgendes geschrieben:
das funktioniert soweit, aber leider funktioniert dann Backspace nicht mehr.
Warum das ?


weil #8 backspace ist... ;)

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Do 04.08.05 14:13 
Danke. habe das #8 weggelassen, jetz gehts :)