TProgressEvent
Specifies an event handler for monitoring the progress of a drawing process.
Declaration
Source position: graphics.pp line 247
type TProgressEvent = TFPImgProgressEvent; |
Description
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. After Stage = psStarting, you are guaranteed that OnProgress will be called again with Stage = psEnding to allow you to free those resources, even if the graphic operation is aborted by an exception. Zero or more calls to OnProgress with Stage = psRunning may occur between the psStarting and psEnding calls.
- 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. PercentDone is 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 Update to force a control to be redrawn immediately in the OnProgress event handler. Redrawing a graphic when RedrawNow = could 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 Msg string can also be empty. Msg strings 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
TGraphic.OnProgress |
|
Event handler signalled to track the progress of operations in the class instance. |
TPicture.OnProgress |
|
Event handler signalled to track the progress of operations in the class instance. |
TProgressStage |
|
Alias for the TFPImgProgressStage type in the FCL. |
Version 3.2 |
Generated 2024-02-25 |
Home |