Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxSpreadSheetTableViewSelection.BeginUpdate Method

In This Article

Postpones all selection change notifications and worksheet redraw operations until an EndUpdate call.

#Declaration

Delphi
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;

Expand Cell Selection Example

Important

Ensure that an EndUpdate call follows every BeginUpdate procedure call, even if an exception occurs.

See Also