Skip to main content

TcxProgressEvent Type

The procedural type used to define progress-tracking events and callback methods.

Declaration

TcxProgressEvent = procedure(Sender: TObject; Percent: Integer) of object;

Parameters

Name Type Description
Sender TObject

The object that raised the progress tracking event.

Percent Integer

The operation progress (as a percentage).

Remarks

A TcxProgressEvent type procedure is a method (an event handler or callback method) that is used to track the progress of a time-consuming operation (like data export) and abort it if necessary by calling Abort within the method.

The Sender parameter specifies an object that fires the progress-tracking event handler or callback method.

The Percent parameter returns the percentage value (which normally ranges from 0 to 100) indicating the progress of an operation being executed.

The following code example shows how to implement a callback method (called TrackProgress) that updates a label caption with the progress of an operation and aborts it if certain conditions are met.

 type
// ...
  TMyForm = class(TForm)
// ...
    procedure TrackProgress(Sender: TObject; Percent: Integer);
// ...
  end;
implementation
procedure TMyForm.TrackProgress(Sender: TObject; Percent: Integer);
begin
  Label1.Caption := IntToStr(Percent) + '% done.';
  if <Your Condition> then
    Abort;
end;
See Also