Skip to main content

TdxSpreadSheetBuiltInTableViewPopupMenu Class

A built-in context menu available in a Table View worksheet.

Declaration

TdxSpreadSheetBuiltInTableViewPopupMenu = class(
    TdxSpreadSheetCustomPopupMenu
)

Remarks

This class implements a context menu that a user can invoke by a click on any worksheet element or a floating container.

You do not need to derive descendants from the TdxSpreadSheetBuiltInTableViewPopupMenu class to customize or replace the built-in worksheet context menu. Handle a spreadsheet control’s OnTableViewContextPopup event instead. The built-in popup menu class does not introduce any new public members, except for a series of constants that indicate menu items associated with the following worksheet content-related commands that:

You can use these constants to identify menu item positions within an event handler to remove a built-in menu item or insert a custom item at a specific position. For instance, the following OnTableViewContextPopup event handler removes the “Merge Cells“ and “Unmerge Cells“ items from the context menu:

procedure TMyForm.dxSpreadSheet1TableViewContextPopup(Sender: TdxSpreadSheetTableView; const P: TPoint; APopupMenu: TPopupMenu; var AHandled: Boolean);
var
  I: Integer;
begin
  if not Sender.HitTest.HitAtContainer then  //  Checks if the context menu is invoked for a row, column header, or a cell, since a floating container's context menu does not have any cell-related items
  begin
    for I := APopupMenu.Items.Count - 1 downto 0 do  // Iterates through all menu items
      // If the current item is "Merge Cells" or "Unmerge Cells"
      if ((APopupMenu.Items[I].Tag = TdxSpreadSheetBuiltInTableViewPopupMenu.cidMerge) or (APopupMenu.Items[I].Tag = TdxSpreadSheetBuiltInTableViewPopupMenu.cidSplit))
      APopupMenu.Items.Delete(I);  // Deletes a menu item
  end;
end;

Inheritance

TObject
TPersistent
TComponent
TdxSpreadSheetCustomPopupMenu
TdxSpreadSheetBuiltInTableViewPopupMenu
See Also