GefContextMenuItems (object)

Contains the menu items for a GefContextMenu.
Description: GefContextMenuItems is a collection of GefContextMenuItem objects.

It contains the menu items owned by an context menu about to be displayed. The collection can be accessed by the MenuItems property of a GefContextMenu. The GefContextMenu, GefContextMenuItem, and GefContextMenuItems objects are only available during the "Before Context Menu" event, and represent temporary objects to manipulate the context menu just before it will be displayed. Any changes to the context menu via these objects will not be persisted from one event execution to the next. This allows the context menu to be adjusted every time just before it is displayed. Thus it can adjust to whatever dynamic conditions are required.

Example:

Sub OnPreContextMenu(oContextMenu As GefContextMenu)
  Dim oContextMenuItem As GefContextMenuItem
  Dim oContextMenuItems As GefContextMenuItems
  
  Set oContextMenuItems = oContextMenu.MenuItems
  
  For Each oContextMenuItem in oContextMenuItems
    If oContextMenuItem.Type = gefMenuItemTypePointTarget Then
      oContextMenuItem.Enabled = False
    Else
      Dim command As Long
      If oContextMenuItem.GetNativeCommandAction(command) Then
        If command = gefMenuCommand_ID_EDIT_POINTVIEW Then
          oContextMenuItem.Enabled = False
        End If
      End If
    End If
  Next oContextMenuItem
End Sub
Properties: Application , Count , Item , Parent
Methods: Add , MoveAfterMenuItem , Remove , RemoveAll