TdxSpreadSheetTableViewSelection.BeginUpdate Method
Postpones all selection change notifications and worksheet redraw operations until an EndUpdate call.
Declaration
procedure BeginUpdate;
Remarks
A spreadsheet control redraws its active worksheet every time a selection state change occurs. Enclose multiple selection state changes between the BeginUpdate and EndUpdate procedure calls to avoid excessive redraw operations.
The following code example selects three non-adjacent cell ranges as a single operation:
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
// Stops selection state updates
ATableView.Selection.BeginUpdate;
// Selects the first cell range (B2:D4)
ATableView.Selection.Add(Rect(1, 1, 3, 3));
// Selects the second cell range (B6:D8)
ATableView.Selection.Add(Rect(1, 5, 3, 7), [ssCtrl]);
// Selects the last cell range (B10:D13) and moves focus to the C12 cell
ATableView.Selection.Add(Rect(1, 9, 3, 12), [ssCtrl], 11, 2);
// Resumes selection state updates and applies all the changes
ATableView.Selection.EndUpdate;
end;
Important
Ensure that an EndUpdate call follows every BeginUpdate procedure call, even if an exception occurs.
See Also