Declared in: EDBMMClient
TMMScriptProgressEvent = procedure(
ASender : TMMScript;
APhase : TMMScriptPhase; // which phase triggered the callback
ACurrent : Int64; // progress numerator (meaning depends on phase)
ATotal : Int64; // progress denominator; 0 when unknown
const AStatus : string // human-readable description of the current step
) of object;
Progress callback assigned to
TMMScript.OnProgress.
Fired at every inter-operation point during Execute so the
caller can update the UI or call
Application.ProcessMessages.
| Parameter | Description |
|---|---|
ASender |
The TMMScript instance that raised the event |
APhase |
Current phase; see TMMScriptPhase |
ACurrent |
Bytes uploaded (spUploading); 0-based page index of the
page about to be fetched (spFetching); rows loaded so far
(spBuilding); 0 otherwise |
ATotal |
Total bytes (spUploading); total row count from the
server (spFetching and spBuilding);
0 when unknown |
AStatus |
Human-readable description suitable for display in a status label or log |
Note for
spFetching:ACurrentis a 0-based page index (fired before each page fetch), whileATotalis the total row count — the units differ intentionally. UsespBuildingwhen you need a row-based progress ratio for a progress bar, since bothACurrentandATotalare in rows for that phase.
// Declare in your form or class:
procedure TMyForm.ScriptProgress(ASender: TMMScript; APhase: TMMScriptPhase;
ACurrent, ATotal: Int64; const AStatus: string);
begin
lblStatus.Caption := AStatus;
if (APhase in [spUploading, spBuilding]) and (ATotal > 0) then
ProgressBar1.Position := Trunc(ACurrent * 100 / ATotal);
Application.ProcessMessages;
end;
// Assignment:
Script.OnProgress := ScriptProgress;