RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomADODataSet.OnFetchProgress Event

Occurs periodically during an asynchronous data retrieval operation.

Pascal
property OnFetchProgress: TFetchProgressEvent;
C++
__property TFetchProgressEvent OnFetchProgress;

Write an OnFetchProgress event handler to take specific action during an asynchronous data retrieval operation. The OnFetchProgress event fires periodically during the data retrieval to provide indications of its progress. Create a handler for this event to react to this periodic notification, such as providing the user with a visual indication of the progress of the data retrieval. 

DataSet is the ADO dataset component that triggered the OnFetchProgress event. This dataset component also contains the recordset in question. 

Progress is the number of records that have been received since the data fetching operation began. 

MaxProgress is the total number of records to be retrieved by the operation. 

Progress and MaxProgress used together to get percent complete. For example, Progress divided by MaxProgress and multiplied by 100 yields the percent completion of the data fetching.

procedure TForm1.ADODataSet1FetchProgress(DataSet: TCustomADODataSet; Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
  Caption := 'Percent complete: ' +
    IntToStr(Trunc(Progress / MaxProgress * 100)) + '%';
  Application.ProcessMessages;
end;

 

void __fastcall TForm1::ADODataSet1FetchProgress(TCustomADODataSet *DataSet, int Progress, int MaxProgress, TEventStatus &EventStatus)
{
  Caption = "Percent complete: " +
    IntToStr(Trunc(Progress / MaxProgress * 100)) + "%";
  Application->ProcessMessages;
}

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!