getEditorMenuOptions

Return a Struct with the menu items to add to the Actions menu of an object editor.

public operation getEditorMenuOptions
  params
    string pObjectUrl: in
    struct pMenu: out
  endparams
			
  ; <... Your code here ...>
			
end ; operation getEditorMenuOptions

Parameters

  • pObjectUrl—URL of the current main development object, in the format ObjectType:ObjectName. For example, cpt:MY_COMPONENT, ent:SALES_ORDER.SALES, aps:MY_APP, libsnp:MYSNIPPETS, and so on.

  • pMenu—a Struct with the menu item to be added to the Actions menu, with optional separators between menu options. For each option, the Struct must define the displayed label, the callback component and operation to be activated, and whether the option is enabled. For details, see Menu Plug-In Structs.

Description

The Actions menu in the object editor is used to perform actions on an individual object. You can use the pObjectUrl to get the current object context and then generate a Struct that is specific to that type of editor, or even to a specific object. For example, it is possible to look up an object property and then include, enable, or disable a menu option based on its value.

Example: Generating object-dependent menu options

The following code generates a different menu option depending on whether the current main development is an application shell or a component.

public operation getEditorMenuOptions
  params
    string pObjectUrl: in  
    byref struct pMenu: out
  endparams

  variables
    string vTypeDescr, vType, vName 
    numeric vPos
  endvariables

  pMenu->$name = "menu"

  ; parse the object URL into the type and  object name				
  vPos = $split(pObjectUrl, 1,":",vType,vName)
				
  selectcase vType
   case "aps"
     call addOption(pMenu, "Start Application", "Test_Aps", "exec", 1)
   case "cpt"
     call addOption(pMenu, "Test with Debug", "Test_Cpt", "testWithDebug", 1)
  endselectcase

  return 0

end ; operation getEditorMenuOptions