Example: |
The following small program shows how to use the OnPercentDone event. Both the function SaveBinary and LoadBinary trigger the OnPercentDone event. The event handler simply displays the percentage of completion by adjusting the progress DataLab bar (callt to ShowStatus):
program MatrixOnPercDone;
procedure MyMatOnPercentDoneEvent (Sender: TObject; PercentDone: integer);
begin
ShowStatus ('processing matrix...', PercentDone);
Application.ProcessMessages;
end;
var
MyMat : TMatrix;
begin
MyMat := TMatrix.Create (nil);
MyMat.Resize (10000,5000);
MyMat.Fill (0,0,0,0,100);
MyMat.OnPercentDone := @MyMatOnPercentDoneEvent;
MyMat.SaveBinary ('c:\temp\mymat.bin');
MyMat.Fill (0,0,0,0,0);
MyMat.LoadBinary ('c:\temp\mymat.bin');
MyMat.OnPercentDone := nil;
MyMat.Free;
end.
|