Código:
TrackBar.Min := -20;
TrackBar.Max := 20;
...
procedure TForm1.TrackBarChange(Sender: TObject);
var
Value: Double;
begin
Value := TrackBar.Position / 10;
Edit.Text := FloatToStr(Value);
end;
procedure TForm1.EditChange(Sender: TObject);
var
Value: Double;
begin
Value := StrToFloatDef(Edit.Text, -10);
if (Value >= -2) and (Value <= 2) then
TrackBar.Position := Trunc(10*Value);
end;
Y si tu versión de Delphi no tiene la función StrToFloatDef la defines tú mismo:
Código:
function StrToFloatDef(S: String; Def: Double): Double;
begin
try
Result := StrToFloat(S);
except
Result := Def;
end;
end;
// Saludos