TdxSpreadSheetBuiltInPageControlTabPopupMenu Class
A built-in context menu available in a spreadsheet control’s caption bar.
Declaration
TdxSpreadSheetBuiltInPageControlTabPopupMenu = class(
TdxSpreadSheetCustomPopupMenu
)
Remarks
This class implements a context menu that a user can invoke by a right-click on a worksheet tab within the caption bar. The context menu composition and menu item state depend on the list of operations available for the target worksheet in the opened document.
You do not need to derive descendants from the TdxSpreadSheetBuiltInPageControlTabPopupMenu class to customize or replace the built-in caption bar context menu. Handle a spreadsheet control’s OnPageControlContextPopup 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 document structure management commands that:
Add new or delete existing worksheets (cidInsert and cidDelete).
Rename worksheets (cidRename).
Enable or disable worksheet protection from accidental content changes (cidProtect and cidUnprotect).
You can use these constants to identify menu item positions within the event handler to remove a built-in menu item or insert a custom item at a specific position. For instance, the following OnPageControlContextPopup event handler removes the “Hide” and “Unhide…” items from the context menu:
procedure TMyForm.dxSpreadSheet1PageControlContextPopup(ASpreadSheet: TdxCustomSpreadSheet; const P: TPoint; APopupMenu: TPopupMenu; var AHandled: Boolean);
var
I: Integer;
begin
for APopupMenu.Items.Count - 1 downto 0 do // Iterates through all menu items
// If the current item is "Hide" or "Unhide..."
if ((APopupMenu.Items[I].Tag = TdxSpreadSheetBuiltInPageControlTabPopupMenu.cidHide) or (APopupMenu.Items[I].Tag = TdxSpreadSheetBuiltInPageControlTabPopupMenu.cidUnhide)) APopupMenu.Items.Delete(I); // Deletes a menu item
end;