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:
Rearrange floating containers (cidBringToFront and cidSendToBack).
Show or hide comment containers (cidToggleCommentVisibility).
Invoke the “Customize Object“ dialog to edit floating containers (cidEditContainer and cidEditComment).
Invoke the “Insert Hyperlink” or “Edit Hyperlink” dialog (cidEditHyperlink).
Activate a hyperlink (cidOpenHyperlink).
Remove hyperlinks and comment containers (cidDeleteHyperlink and cidDeleteComments).
Hide or display hidden columns and rows (cidHide and cidUnhide).
Merge cells and split merged cells (cidMerge and cidSplit).
Cut or copy the active selection to the clipboard (cidCut and cidCopy).
Paste the clipboard’s content with different settings (cidPaste, cidPasteSpecialFormulas, cidPasteSpecialFormulasAndColumnWidths, cidPasteSpecialFormulasAndFormatting, cidPasteSpecialFormulasAndStyles, cidPasteSpecialValues, cidPasteSpecialValuesAndFormatting, and cidPasteSpecialValuesAndStyles).
Clear cell values (cidClearContent).
Invoke the “Format Cells“ and “Paste Special“ dialogs for the active selection (cidFormatCells and cidShowPasteSpecialDialog).
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;