TProgressEvent type
Specifies an event handler for monitoring the progress of a drawing process.
Declaration
TProgressEvent = TFPImgProgressEventDescription
TProgressEvent is a alias for the TFPImgProgressEvent type in the
FCL. It specifies an event handler used to perform progress notifications for
computationally intensive (slow) operations such as loading, storing, or
transforming graphic image data.
The object procedure type (defined in fpimage.pp) includes the following parameters:
- Sender
- Object instance for the notification.
- Stage
- Indicates whether the notification is to prepare for, process, or clean up
after a graphic operation. The first call for a graphic operation will be with
Stage = psStarting, to allow the event handler to allocate whatever resources it needs to process subsequent progress notifications. AfterStage = psStarting, you are guaranteed thatOnProgresswill be called again withStage = psEndingto allow you to free those resources, even if the graphic operation is aborted by an exception. Zero or more calls toOnProgresswithStage = psRunningmay occur between thepsStartingandpsEndingcalls. - PercentDone
- The ratio of work done to work remaining, on a scale of 0 to 100. Values may
repeat or even regress (get smaller) in successive calls.
PercentDoneis usually a guess, and the guess may be dramatically altered as new information is discovered in decoding the image. The value of this property could usefully be passed to a ProgressBar to show the user the progress for the operation. Please note that the Byte type used for the argument allows a value which can exceed 100. - RedrawNow
- Indicates whether the graphic can or should be redrawn immediately. Useful
for showing successive approximations of an image as data is available
instead of waiting for all the data to arrive before drawing anything. Since
there is no message loop activity during graphic operations, you should call
Updateto force a control to be redrawn immediately in theOnProgressevent handler. Redrawing a graphic whenRedrawNow = Falsecould corrupt the image or cause exceptions. - R
- TRect instance with the area on an image that has been changed and needs to be redrawn.
- Msg
- Optional text describing in one or two words what the graphic class is
currently working on. For example: "Loading", "Storing", "Reducing colors",
etc. The
Msgstring can also be empty.Msgstrings should be resourced for translation, should not contain trailing periods, and should be used only for display purposes. (Do not use the construct: if Msg = 'Loading' then...). - Continue
- Variable Boolean argument which indicates if the current operation can be continued. Set Continue to False to notifiy the calling procedure that the operation should be aborted.
TProgressEvent is the type used to implement the OnProgress property in TGraphic and TPicture.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
