TiComponent.UpdateFrameRate

TiComponent See Also

Specifies the frame rate at which the control automatically repaints.

property UpdateFrameRate : Integer

Description

Use UpdateFrameRate to get or set the frame rate at which the control repaints.

The frame rate is used to improve performance by controlling the number of times the control repaints itself per second. To activate automatic frame rate control, the UpdateFrameRate property must be non zero and the BeginUpdate method must be called. To deactivate automatic frame rate control, call the EndUpdate method.

Each time a change occurs to the control that requires a repaint, the control will determine if a new frame needs to be displayed. The FrameTime is one second divided by the UpdateFrameRate. If a change occurs to the control before the FrameTime has elapsed, the control is not repainted. If a change occurs to the control after the FrameTime has elapsed, the control is repainted and the next frame is started.

There must be a steady stream of changes to the control that require repainting for the automatic frame rate control to function correctly. The rate of change per second must be greater than the UpdateFrameRate for the desired frame rate to be achieved. Once changes to the control that require repainting have been stopped, call the EndUpdate method to force the control to repaint the last changes that may be cached.

When the frame rate control is inactive, the control will attempt to repaint when a change is made to the control that requires a repaint. The actual number of repaints per second is dependent of the system hardware, system activity, and the number of request being made to repaint the control.

The frame rate can be manually controlled by using the BeginUpdate and EndUpdate methods. Make sure that the UpdateFrameRate property is set to 0 to disable automatic frame rate control. Your code will need to keep track of the last update before beginning a new frame. To begin a new frame, call the EndUpdate method and then the BeginUpdate method to start the next frame.

Example

Delphi

iComponent.UpdateFrameRate := 5;

C++ Builder

iComponent->UpdateFrameRate = 5;

Contents | Index | Previous | Next