Skip to main content

TdxCustomLayoutControl.CancelUpdate Method

Re-enables change notifications and postpones applying pending changes made in the Layout control after a BeginUpdate call until the next content or appearance setting change.

Declaration

procedure CancelUpdate;

Remarks

Every time you change a layout item, group, or appearance setting, the Layout control redraws its content to reflect the change. Enclose multiple content and appearance changes in BeginUpdate and EndUpdate procedure calls to avoid UI flickering caused by excessive redraw operations and improve performance.

BeginUpdate/CancelUpdate and Batch Changes

A BeginUpdate procedure call disables notifications and postpones applying all changes until an EndUpdate or CancelUpdate call. Unlike EndUpdate, the CancelUpdate procedure does not apply pending changes to the Layout control and its content. CancelUpdate only re-enables change notifications and corresponding redraw operations. The Layout control applies pending changes made between BeginUpdate and CancelUpdate calls after the next content or appearance change.

Note

Ensure that every BeginUpdate procedure call is followed by an EndUpdate or CancelUpdate call, even if an exception occurs. Otherwise, all layout items, groups, and embedded controls remain frozen and unresponsive.

CancelUpdate Usage Scenarios

The CancelUpdate procedure is for rare scenarios where you need to configure and populate the Layout control while it is invisible. The EndUpdate procedure forces extensive data and layout recalculations on the UI thread that may take a noticeable amount of time and temporarily make the application UI unresponsive.

If the Layout control is invisible during this process, you may want to re-enable change notifications and postpone applying pending changes until the next change made after a CancelUpdate procedure call. For example, this technique is useful if you need to configure and populate the Layout control before your application displays it for the first time and want to avoid temporarily making the visible application UI unresponsive.

See Also