Back to Devexpress

TcxProgressEvent Type

vcl-cxclasses-1da30772.md

latest1.9 KB
Original Source

TcxProgressEvent Type

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

Declaration

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

Parameters

NameTypeDescription
SenderTObject

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.

delphi
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;
cpp
void __fastcall TMyForm::TrackProgress(TObject *Sender, int Percent)
{
  Label1->Caption = IntToStr(Percent) + "% done.";
  if(Condition)
  {
    Abort;
  }
}

See Also

cxClasses Unit