Da du die Berechnung vom Kontext abhängig machst
(z.B.
- Anfang: Ende = Anfang - Dauer
- Ende: Dauer = Anfang - Ende
- Dauer: Ende = Anfang + Dauer
)
musst du dir wohl oder übel auch den Kontext merken und nicht einfach nur drauf los rechnen

Den Kontext (aktives Feld) bekommt man aber auch über
TForm.ActiveControl
Eine andere Möglichkeit wäre, die Berechnung entsprechend zu unterbinden, wenn man schon berechnet:
Delphi-Quellcode:
type
TForm1 = class( TForm )
Anfang_SpinEdit : TSpinEdit;
Ende_SpinEdit : TSpinEdit;
Interval_SpinEdit : TSpinEdit;
// alle 3 Felder rufen bei OnChange diese Methode auf
procedure ControlChange( Sender : TObject );
private
FCalculating : Boolean;
procedure DoCalculate( Context : TObject );
public
{ Public-Deklarationen }
end;
var
Form1 : TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.ControlChange( Sender : TObject );
begin
// Wenn die Berechnung schon läuft, dann wieder raus hier
if FCalculating then
Exit;
// Berechnungs-Flag setzen
FCalculating := True;
try
// Berechnung durchführen
DoCalculate( Sender );
finally
// Berechnungs-Flag entfernen
FCalculating := False;
end;
end;
procedure TForm1.DoCalculate( Context : TObject );
begin
// abhängig vom Context die Berechnung durchführen
if Context = Anfang_SpinEdit then
begin
Ende_SpinEdit.Value := Anfang_SpinEdit.Value + Interval_SpinEdit.Value;
end
else if Context = Ende_SpinEdit then
begin
Interval_SpinEdit.Value := Ende_SpinEdit.Value - Anfang_SpinEdit.Value;
end
else if Context = Interval_SpinEdit then
begin
Ende_SpinEdit.Value := Anfang_SpinEdit.Value + Interval_SpinEdit.Value;
end;
end;
Kaum macht man's richtig - schon funktioniert's

Zertifikat: Sir Rufo (Fingerprint: ea 0a 4c 14 0d b6 3a a4 c1 c5 b9
dc 90 9d f0 e9 de 13 da 60)