Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
/img/help/home.gif /img/help/prev.gif /img/help/next.gif

 

Indicating a progress

 


 

All ECL streams provide a convenient feature allowing developer to display a progress during some potentially slow operations, such as encrypting/decrypting a file, changing compression level, reading and writing a large portion of data, calling LoadFromFile and SaveToFile functions.

 

To provide user a feedback about the progress of the above operations, you should do the following:

  1. Write an event handler that will display the current progress of a process using a progress bar.
  2. Assign the above event handler to the ECL stream OnProgress event.
  3.  

    The following example shows how to display the current progress while loading and compressing a file.

    Example:

    procedure TMainForm.CountProgress(Sender: TObject; PercentDone: Real);

    begin

    ProgressBar.Progress := Round(PercentDone);

    Application.ProcessMessages;

    end;

     

    procedure TMainForm.Button1Click(Sender: TObject);

    var

    CompFS: TECLFileStream;

    begin

    { create compressed file }

    CompFS := TECLFileStream.Create('c:\test_comp.ecl', fmCreate, '', ppmMax);

    { assign event handler }

    CompFS.OnProgress := CountProgress;

    { load and compress data from test.txt file}

    CompFS.LoadFromFile('c:\test.txt');

    { close compressed file }

    CompFS.Free;

    end;

     

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Mar 29, 2024