ImageEn, unit iemview

TImageEnMView.OnProgress

TImageEnMView.OnProgress


Declaration

property OnProgress: TIEProgressEvent;


Description

Occurs during image processing or input/output operations. It is useful to display progress to the user of the current task.

You can use ProgressTask to determine what action is underway.
Alternatively, check the class of the sender:
TImageEnMIO: Loading of multi-frame images (ietLoading, ietSaving, ietAcquisition, ietPrinting)
TImageEnProc: Edit/effect processing of images (ietProcessing, ietAnalysis, ietResampling, ietRotating)
TImageEnMView: Filling content from a folder (when not loading on-demand) (ietFilling)
TImageEnFolderMView: Reading image list when sub-folders are included (ietFilling)

Note:
You can use OnFinishWork to reset the progress when the task has completed
Progress for loading of single frame images and thumbnails (using a TImageEnIO) occurs with OnIOProgress
Progress values are unreliable when filling a TImageEnFolderMView with sub-folders. The maximum value (denominator) is be specified by SubFolderLimit


Examples

// An example showing separate progress display for I/O operations and processing operations
procedure TMainForm.ImageEnMView1Progress(Sender: TObject; per: Integer);
begin
  // IMAGE PROCESSING PROGRESS
  if Sender is TImageEnProc then
  begin
    ProcProgressBar.Position := per;
    ProcProgressBar.Visible := True;
  end
  else
  // I/O PROGRESS
  begin
    IOProgressBar.Position := per;
    IOProgressBar.Visible := True;

    // Hide abort button
    btnAbort.Visible := False;
  end;
end;

// Hide the progress bar
procedure TMainForm.ImageEnMView1FinishWork(Sender: TObject);
begin
  // IMAGE PROCESSING PROGRESS
  if Sender is TImageEnProc then
    ProcProgressBar.Visible := False
  else
  // I/O PROGRESS
  begin
    IOProgressBar.Visible := False;

    // If filling content, allow user to abort
    if Sender is TImageEnMView then
      btnAbort.Visible := False;
  end;
end;

// Showing detailed progress display
procedure TMainForm.ImageEnMView1Progress(Sender: TObject; per: Integer);
begin
  case ImageEnMView1.ProgressTask of
    ietLoading     : Caption := format( 'Loading - %d%%', [per] );
    ietSaving      : Caption := format( 'Saving - %d%%', [per] );
    ietAcquisition : Caption := format( 'Acquiring - %d%%', [per] );
    ietPrinting    : Caption := format( 'Printing - %d%%', [per] );
    ietFilling     : Caption := format( 'Filling - %d%%', [per] );
    else             Caption := format( 'Processing - %d%%', [per] );  // Should not occur
  end;
end;