ParentKey (OlapMenuItem)

Analysis Services Programming

Analysis Services Programming

ParentKey (OlapMenuItem)

The ParentKey property of an OlapMenuItem object contains the Key property of the parent of the menu item.

Data Type

Long

Access

Read/write

Remarks

The ParentKey property is used to associate a child menu item with a parent (or owner) pop-up menu item.

Example

The following example builds a menu item with child menu items underneath it:

Private Enum PopupItems
  mnuPopSpecial
  mnuPopAverage
  mnuPopPoor
End Enum

Private Enum MenuActions
  mnuAddNew
  mnuRefresh
  mnuDelete
End Enum

Private Sub IOlapAddIn_ProvideMenuItems( _
    CurrentNode Ad DSSAddInsManager.OlapTreeNode, _
    MenuItems As DSSAddInsManager.OlapMenuItems)
  On Error GoTo ProvideMenuItems_Err 'Handle errors
  'MenuItems is a collection for MenuItem objects
  'Some more code
  '"Special" is displayed on the root menu as a pop-up
  '"New", "Refresh", and "Delete" are items on Special's child menu
  'flagged by the mnuPopSpecial enumeration
  MenuItems.Add mnuStandard, "&Special", mnuPopSpecial, , _ 
      mnuflagRegular + mnuflagPopup
  MenuItems.Add mnuStandard, _
      "&New", mnuAddNew, mnuPopSpecial, mnuflagSubmenu
  MenuItems.Add mnuStandard, _
      "&Refresh", mnuRefresh, mnuPopSpecial, mnuflagSubmenu
  MenuItems.Add mnuStandard, _
      "&Delete", mnuDelete, mnuPopSpecial, mnuflagSubmenu
  Exit Sub
ProvideMenuItems_Err:
  MsgBox "ProvideMenuItems Failed"
  Err.Clear
End Sub

See Also

OlapMenuItem