Habe die Werte von MinValue und MaxValue mit FloatToStr() ausgegeben.
MinValue = -99999,999
MaxValue = 99999,999
Also unterschiedlich.
Gruß
Jürgen
[erledigt] SpinEditEx und FloatSpinEditEx
- m.fuchs
- Lazarusforum e. V.
- Beiträge: 2805
- Registriert: Fr 22. Sep 2006, 19:32
- OS, Lazarus, FPC: Winux (Lazarus 2.0.10, FPC 3.2.0)
- CPU-Target: x86, x64, arm
- Wohnort: Berlin
- Kontaktdaten:
Re: SpinEditEx und FloatSpinEditEx
Du kannst natürlich auch die Rückmeldung an den Benutzer noch verbessern:
Damit sieht man sofort ob der eingegebene Wert falsch ist und als Bonus kann der OK-Button deines Forms auch noch deaktiviert werden, wenn die Werte nicht passen.
Code: Alles auswählen
procedure TForm1.FloatSpinEditEx1Change(Sender: TObject);
var
CurrentValue: Double;
begin
CurrentValue := StrToFloatDef(FloatSpinEditEx1.Text, Double.MinValue);
if (CurrentValue >= FloatSpinEditEx1.MinValue) and (CurrentValue <= FloatSpinEditEx1.MaxValue) then begin
FloatSpinEditEx1.Color := clGreen;
Button1.Enabled := True;
end else begin
FloatSpinEditEx1.Color := clRed;
Button1.Enabled := False;
end;
end;
Software, Bibliotheken, Vorträge und mehr: https://www.ypa-software.de