Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Creating a Custom Delete Callback

  • Last UpdatedJan 09, 2024
  • 1 minute read

Users may want to replace the callback for the CE option on the Delete menu in Design with a customized callback. This can be done using an add-in, without modifying the AVEVA supplied files. To apply the changes in a new version of Marine, the files can simply be copied across.

Create an APPMENU object corresponding to the Delete menu.

!menu = object APPMENU('sysDel')

Hide the menu field CE on this menu

!menu.remove('CE')

Insert a new menu option to replace it

!menu.insertAfter('CE', 'CALLBACK', 'Delete',

'!!customDelete()', 'customDeleteCE')

Register the object with !!appMenuCntrl so the menu item is replaced in all applications.

!!appMenuCntrl.addMenu(!menu, 'ALL')

The callback of the Delete button on the main toolbar can also be modified.

!!appDesMain.mtbDeleteCe.callback = '!!customDelete()'

A sample add-in object definition, which must be put in the PMLLIB path, is shown below.

define object APPCUSTOMDELETE

endobject

define method .modifyForm()

 -- change callback on Delete toolbar button

 !!appDesMain.mtbDeleteCe.callback = '!!customDelete()'

endmethod

define method .modifyMenus()

 !this.deleteMenu()

endmethod

define method .deleteMenu()

 !menu = object APPMENU('sysDel')

 -- replace CE option on menu with custom delete function

 !menu.remove('CE')

 !menu.insertAfter('CE', 'CALLBACK', 'CE', '!!customDelete()', 'customDelete')

 -- we want the menu to be replaced in all applications, so

 -- register this object in all applications

 !!appMenuCntrl.addMenu(!menu, 'ALL')

endmethod

The corresponding add-in definition file, which is put in the DES\DFLTS\ADDINS directory, contains:

Name:CUSTOMDELETE

Object:APPCUSTOMDELETE

Related Links
TitleResults for “How to create a CRG?”Also Available in