Adding a Menu Field
- Last UpdatedJan 09, 2024
- 1 minute read
It is simple to use a PML add-in to add a field to a menu in Marine. The following example shows how to add an extra field to the Query menu in the Design Pipework application.
Create an APPMENU object corresponding to the menu.
!menu = object APPMENU('sysQry')
Add the required field to the menu
!menu.add('CALLBACK', 'Query Owner', 'q owner', 'QueryOwner')
Register the APPMENU object with !!appMenuCntrl, so the menu is visible in the Pipework application
!!appMenuCntrl.addMenu(!menu, 'PIPE')
The same method can be used to add fields to any menu descended from the bar menu of the main form.
A sample add-in object definition, which must be put in the PMLLIB path, is shown below.
define object APPADDQUERYMENUFIELD
endobject
define method .modifyMenus()
!this.queryMenu()
endmethod
define method .queryMenu()
-- define APPMENU object associated with the Query menu
!menu = object APPMENU('sysQry')
-- add field to query the owner of the current element
!menu.add('CALLBACK', 'Query Owner', 'q owner', 'QueryOwner')
-- register the APPMENU object to be visible in the Pipework
-- application
!!appMenuCntrl.addMenu(!menu, 'PIPE')
endmethod
The corresponding add-in definition file, which is put in the DES\DFLTS\ADDINS directory, contains:
Name: ADDQUERYMENUFIELD
Object: APPADDQUERYMENUFIELD