GefContextMenuItem.SetActionToProcedure (method)

Makes the menu item run a procedure if selected
Syntax: Boolean = object.SetActionToProcedure ( ProcedureName, UserParamater )
ProcedureName As String - The name of the procedure
Optional UserParamater As String - An optional user paramater
Description: The SetActionToProcedure method makes the menu item run a previously defined procedure when it is selected. The procedure must exist in the Parent object of the GefContextMenu or one of the container objects of that object.


Sub OnPreContextMenu(oContextMenu As GefContextMenu)
  Dim oContextMenuItem As GefContextMenuItem
  Dim oMenuItems As GefContextMenuItems
  Set oMenuItems = oContextMenu.MenuItems
  Set oContextMenuItem = oMenuItems.Add
  oContextMenuItem.Text = "Custom procedure menu items"
  Dim oSubMenu As GefContextMenu
  Set oSubMenu = oContextMenuItem.SubMenu
  Dim oSubMenuItem As GefContextMenuItem
  Set oSubMenuItem = oSubMenu.MenuItems.Add
  oSubMenuItem.SetActionToProcedure "OnMyProcMenu1"
  oSubMenuItem.Text = "OnMyProcMenu1"
  oSubMenuItem.Checked = True
  oSubMenuItem.Translated = False
End Sub