GefContextMenuItems.MoveAfterMenuItem (method)

Places the menu item after the specified menu item.
Syntax: object.MoveAfterMenuItem MenuItemToMove, MenuItemPrev
Parameters:
MenuItemToMove As GefContextMenuItem - The menuitem that will be moved
MenuItemPrev As GefContextMenuItem - The menuitem that will be the previous menu item of the item that is moved.
Description: The menu items must already be members of the menu. They connot belong to another menu or sub menu. If the MenuItemPrev is Nothing then the item being moved will be moved to the begining of the menu.

Example:

Sub OnMyMenu4
  MsgBox "OnMyMenu4"
End Sub
  
Sub OnMyMenu3
  MsgBox "OnMyMenu3"
End Sub
Sub OnMyMenu2
  MsgBox "OnMyMenu2"
End Sub
Sub OnPreContextMenu(oContextMenu As GefContextMenu)
  Dim oContextMenuItem0 As GefContextMenuItem
  Dim oContextMenuItem As GefContextMenuItem
  Dim oContextMenuItem1 As GefContextMenuItem
  Dim oMenuItems As GefContextMenuItems
  
  Set oMenuItems = oContextMenu.MenuItems
  oMenuItems.RemoveAll
  
  Set oContextMenuItem0 = oMenuItems.Add
  
  oContextMenuItem0.SetActionToScript "OnMyMenu4"
  oContextMenuItem0.Text = "OnMyMenu4"
  oContextMenuItem0.Enabled = False
  
  Set oContextMenuItem = oMenuItems.Add
  
  oContextMenuItem.SetActionToScript "OnMyMenu2"
  oContextMenuItem.Text = "OnMyMenu2"
  oContextMenuItem.Checked = True
  
  Set oContextMenuItem = oMenuItems.Add
  
  oContextMenuItem.SetActionToScript "OnMyMenu3"
  oContextMenuItem.Text = "OnMyMenu3"
  oContextMenuItem.Enabled = False
  
  
  Set oContextMenuItem1 = oMenuItems.Add
  
  oContextMenuItem1.MakeSubMenu
  oContextMenuItem1.Text = "MySub"
  
  Dim oSubMenu As GefContextMenu
  
  Set oSubMenu = oContextMenuItem1.SubMenu
  
  Set oContextMenuItem = oSubMenu.MenuItems.Add
  
  oContextMenuItem.SetActionToScript "OnMyMenu2"
  oContextMenuItem.Text = "OnMyMenu2"
  oContextMenuItem.Checked = True
  
  Set oContextMenuItem = oSubMenu.MenuItems.Add
  
  oContextMenuItem.SetActionToScript "OnMyMenu3"
  oContextMenuItem.Text = "OnMyMenu3"
  oContextMenuItem.Enabled = False
  
  oMenuItems.MoveAfterMenuItem oContextMenuItem0, oContextMenuItem1
  
End Sub