Ver Mensaje Individual
  #13  
Antiguo 12-11-2003
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
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
Responder Con Cita