Hola Olenkaguilar.
Lo que te sugiere
radenf es muy buena opción, sobre todo por que te ahorras controlar los valores de un edit.
Y para organizár y reducir el código podes hacer:
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
begin
with SpinEdit1 do
begin
MinValue:= 1;
MaxValue:= 32;
Increment:= 1;
OnChange:= SpinAndEditChange;
end;
Edit2.Text:= '1'; Edit2.OnChange:= SpinAndEditChange;
end;
procedure TForm1.SpinAndEditChange(Sender: TObject);
const
VEC: array[1..32] of Single =
(0.2 , 0.35, 0.5 , 0.6 , 0.68, 0.7 , 0.7 , 0.7 ,
0.68, 0.6 , 0.5 , 0.35, 0.25, 0.15, 0.05, 0.15,
0.2 , 0.25, 0.5 , 0.55, 0.6 , 0.6 , 0.6 , 0.65,
0.67, 0.6 , 0.5 , 0.45, 0.28, 0.18, 0.1 , 0.1);
begin
Edit3.Text:= FormatFloat('0.000', (VEC[SpinEdit1.Value]*StrToFloatDef(Edit2.Text, 0))+70);
end;
(*) Todo el código del evento
OnCreate lo podes evitar configurando las propiedades en tiempo de diseño con el
Object Inspector.
Saludos
