TdxCustomRibbon.BeginUpdate Method
Postpones all Ribbon UI redraw operations that reflect any content or appearance change until an EndUpdate procedure call.
Declaration
procedure BeginUpdate;
Remarks
Every time you manage Ribbon UI elements or change Ribbon control settings, the control redraws itself to reflect the change. Enclose multiple Ribbon control setting changes between BeginUpdate
and EndUpdate procedure calls to avoid UI flickering due to excessive redraw operations and improve performance.
BeginUpdate/EndUpdate Calls 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 corresponding redraw operations
- Applies all changes made after a
BeginUpdate
call - Sends corresponding notifications in a batch
- Redraws the Ribbon control
Note
Ensure that every BeginUpdate
procedure call is followed by an EndUpdate procedure call, even if an exception occurs. Otherwise, the Ribbon UI remains frozen and unresponsive.
Code Example: Apply Individual Ribbon Skin and Color Accent
The following code example applies the built-in Colorful
skin and its Green
color accent to the Ribbon control in a TdxSpreadSheet control-based application that uses the WXI
global skin and its Sharpness
palette:
uses
dxRibbon; // This unit declares the TdxRibbon class
// ...
procedure TMyForm.FormCreate(Sender: TObject);
begin
DisableAero := True;
dxRibbon1.BeginUpdate; // Initiates the following batch change
try
dxRibbon1.UseGlobalSkin := bFalse;
dxRibbon1.Style := rsOffice365;
dxRibbon1.ColorSchemeName := 'Colorful';
dxRibbon1.ColorSchemeAccent := rcsaGreen;
finally
dxRibbon1.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;