TcxLockablePersistent.EndUpdate Method
Applies all pending changes and redraws the parent object after a BeginUpdate procedure call.
Declaration
procedure EndUpdate; virtual;
Remarks
Every time you modify a setting in the current property set, its parent object (a control, component, or visual element) redraws itself to reflect the change. Enclose multiple setting changes between BeginUpdate and EndUpdate
procedure calls to avoid UI flickering due to excessive redraw operations and improve performance.
BeginUpdate/EndUpdate and Batch Changes
A BeginUpdate procedure call disables notifications and postpones all changes until an EndUpdate
call. A subsequent EndUpdate
call does the following:
- Re-enables change notifications and the corresponding redraw operations
- Applies all changes made after a BeginUpdate call
- Sends the corresponding notifications in a batch
- Redraws the parent object
Note
Ensure that every BeginUpdate procedure call is followed by an EndUpdate
or CancelUpdate procedure call, even if an exception occurs. Otherwise, the parent object remains frozen and unresponsive.
CancelUpdate Usage Scenario – Preliminary Configuration
The EndUpdate
procedure invokes the apply changes operation in the UI thread. Depending on the number of changes and available system resources, this operation may take a noticeable amount of time and render the application UI temporarily unresponsive. You can call CancelUpdate instead of the EndUpdate
procedure when you need to make multiple changes in a batch before your application displays the component to avoid an unnecessary freeze-up of the currently visible UI. The component redraws itself when the first content or setting change occurs after a CancelUpdate procedure call.