I have function which is reaction on button click. When I click on the button it should start repeat and write values form an array and show them in labels on main form. Pro
I used two timers to update "slowly" some values (so that the user can see the progress) without slowing down the application or, in the worst case, the system.
// "weights" for old and new value; I was working on integers
var
Wa: integer = 1;
Wb: integer = 9;
Wt: integer = 10;
// interval of 1000 ms, of course
procedure frmMain.T1000Timer(Sender: TObject);
begin
Wa:= 1;
nValue:= calculate_new_value;
end;
// 100 ms interval
procedure frmMain.T100Timer(Sender: TObject);
begin
Wb:= Wt -Wa;
// displayed value, ie gauge.progress, or something.Value, etc.
sam.Value:= Round( (Wb *sam.Value +Wa *nValue) /Wt );
if Wa < Wt then Inc(Wa);
end;