Autor Beitrag
Cyborgmillenium
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 20:37 
Hallo,
möchte die Eingabe vor dem Komma begrenzen.
Beispiel: Man darf 360,0000 eintippen aber nicht 361,0000 und nach der dritten Stelle muss das Komma folgen. Also nicht 3600,000.

Danke
Cyborgmillenium
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 25.06.02 21:14 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
const
  Editalt : String = '';

procedure TForm1.Edit1Change(Sender: TObject);
var
  r : Single;
  e : Integer;
begin
  Val(Edit1.Text, r, e);
  if (r > 360) or (e <> 0)then Edit1.Text := Editalt else Editalt := Edit1.Text;
end;
Versuchs mal damit. :)
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 21:36 
Da gibt es ein Problem.
Ich Überprüfe das wärend der Eingabe also OnChange.
Jetzt soll der Benutzer aber 360,0000 eingeben können, aber nicht 360,0001.
Bei deinem Vorschlag kann ich aber garkein Komma mehr eintragen.

Vielleicht kannste das ja noch verbessern.
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 25.06.02 22:12 
Zitat:
gar kein Komma mehr eintragen
Aber der dezimal Punkt geht, oder kannst Du in einer Tabellenkakulation das ',' nehmen ? :)
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:15 
Ich werde mal eben testen
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:20 
Punkt geht nicht, weil er damit nicht rechnen kann.
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 25.06.02 22:26 
Das das Komma nicht geht ist mir logisch, aber das man mit dem Punkt nicht rechnen kann währe für mich neu. :)
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:33 
Er gibt mir eien Fehler, wenn ich rechnen will.
23. is not a valid floatig point.

Vieleicht sagt dir das was.
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:34 
also ich wollte hier 23.blablabla eingeben
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 25.06.02 22:37 
kommt die Fehlermeldung von OnChange ?

also ich kann im Edit 23. eingeben. :)
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:42 
wie schon gesagt, alles is in der onchange funktion des textfeldes.
Muss ich da etwa nen extra Button machen oder hast du nen Button benutzt?
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Di 25.06.02 22:44 
nein, nur diesen Code der in meinem Posting steht.
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 25.06.02 22:47 
Is schon klar.
Hab den Code jetzt mal in einen Button getan, jetzt funzt es.