ProvideMenuItems (IOlapAddIn Interface)

Analysis Services Programming

Analysis Services Programming

ProvideMenuItems (IOlapAddIn Interface)

The ProvideMenuItems method of the IOlapAddIn interface enables default menu items and adds new menu items to the current tree node.

Syntax

Sub ProvideMenuItems(CurrentNode As OlapTreeNode, MenuItems As OlapMenuItems)

CurrentNode

The OlapTreeNode object that is selected for menu display in the tree pane when users right-click.

MenuItems

A collection of OlapMenuItem objects.

Remarks

This method responds when the calling subroutine sends a request for default menu items to be enabled or for new menu items to be added. When your add-in enables default menu items, it should also provide associated child menu items.

Note  You should initialize the enumerations provided for menu items and menu actions added to MenuItems with a positive, nonzero value. Enumerations initialized to zero may cause unpredictable results when this method provides menu items for a custom add-in.

Example

The following example enables a new default menu item:

Private Enum MenuActions
  mnuActTop = 1
  mnuActMid
  mnuActBtm
  mnuActSpc
End Enum

Private Sub IOlapAddIn_ProvideMenuItems(CurrentNode As _
    DSSAddInsManager.OlapTreeNode, MenuItems As _
    DSSAddInsManager.OlapMenuItems)
  On Error GoTo ProvideMenuItems_Err 'Handle errors
  If CurrentNode.Caption = "Node 1" Then
    'Enable default new menu item and add child menu items
    MenuItems.Add mnuStandard, "&Top", mnuActTop, , mnuflagNew
    MenuItems.Add mnuStandard, "&Mid", mnuActMid, , mnuflagNew
    MenuItems.Add mnuStandard, "&Btm", mnuActBtm, , mnuflagNew
    'Add regular menu item to root menu
    MenuItems.Add mnuStandard, "&Special", mnuActSpc, , mnuflagRegular
  End If
  Exit Sub

ProvideMenuItems_Err:
  MsgBox "ProvideMenuItems failed"
  Err.Clear
End Sub

See Also

IOlapAddIn Interface