TdxSpreadSheetCustomConditionalFormattingRule.EndUpdate Method
Applies all pending changes and redraws the parent control after a BeginUpdate procedure call.
#Declaration
procedure EndUpdate;
#Remarks
Every time you change conditional formatting rule settings, the parent control redraws its content to reflect the change. Enclose multiple conditional formatting rule changes between BeginUpdate and EndUpdate
procedure calls to avoid UI flickering due to excessive redraw operations and improve performance.
#BeginUpdate/EndUpdate Procedure 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 in the parent control
- Applies all changes made after a BeginUpdate call
- Sends corresponding notifications in a batch
- Redraws the parent control
Note
Ensure that every BeginEnd
procedure call, even if an exception occurs. Otherwise, the parent control remains frozen and unresponsive.
#Code Example: Apply a Data Bar Conditional Formatting Rule to a Data Grid Column
The following code example creates a data bar conditional formatting rule and applies it to a column in a TcxGrid control’s data-aware Table View:
var
ARule: TdxSpreadSheetConditionalFormattingRuleDataBar;
begin
cxGrid1DBTableView1.ConditionalFormatting.Add(cxGrid1DBTableView1Column1.Caption,
TdxSpreadSheetConditionalFormattingRuleDataBar, ARule);
ARule.BeginUpdate; // Initiates the following batch change
try
ARule.Style.NegativeBarColor := clRed;
ARule.Style.NegativeBarBorderColor := clRed;
ARule.Style.PositiveBarColor := clGreen;
ARule.Style.PositiveBarBorderColor := clGreen;
ARule.Style.FillMode := dbfmSolid;
finally
ARule.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;