TFeedbackProc

Discussion around the SDL Component Suite
Post Reply
dwilbourn
Posts: 2
Joined: Fri Nov 20, 2020 2:01 pm

TFeedbackProc

Post by dwilbourn »

I would like to make use of the Feedback value in CountLinesInTextFile but I don't know how. The help just says "The type declaration TFeedbackProc defines a universal callback routine which is used in various mathematical procedures to provide feedback during time consuming calculations."
Is there an example of how to actually do this in code?
User avatar
hlohning
Posts: 7
Joined: Fri Sep 04, 2020 4:17 pm

Re: TFeedbackProc

Post by hlohning »

Here's a code snippet which creates the feedback. Please note the far declaration of the feedback procedure:

Code: Select all


(******************************************************************************)
procedure DoFeedback (Sender: TObject; StateCnt: double; PercentDone: double); far;
(******************************************************************************)

begin
FrmMain.ProgBar1.Value := (round(StateCnt/100000) mod 100);
Application.ProcessMessages;
end;



(******************************************************************************)
procedure TFrmMain.Button1Click(Sender: TObject);
(******************************************************************************)

var
  IFile : TextFile;
  nlin  : integer;

begin
if ODiag.Execute then
  begin
  AssignFile (IFile, ODiag.FileName);
  reset (IFile);
  nlin := CountLinesInTextFile (IFile, DoFeedback);
  closefile (IFile);
  end;
end;
Hope this helps, Hans
---
Hans Lohninger
Epina GmbH
Retz, Austria
dwilbourn
Posts: 2
Joined: Fri Nov 20, 2020 2:01 pm

Re: TFeedbackProc

Post by dwilbourn »

Thanks, I will give that a go!
Post Reply