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

AVEVA™ Engineering

Add-in Applications

  • Last UpdatedNov 14, 2022
  • 2 minute read

The application controller adds new add-in applications to the Application Selector in the quick access toolbar. When an add-in application is selected the system sends out a context change event that application tab command objects subscribe to. They use this event to show or hide the tab and to set focus on a tab if required.

The example below is taken from the tab command object used to control the equipment tab. An equipment tab is shown when the equipment, piping or HVAC applications are selected.

The refresh method responds to an application change context event, and sets tab visibility according to the content of the context message.

define method .refresh(!args is ARRAY)

-- check that this message is for Application tabs

!message = !args[2]

if( !message.subString(1,12) neq 'Application:' ) then

return

endif

!message = !message.after('Application:')

if (!message eq 'EQUI') then

-- Equipment Application selected - show tab and select it

!this.visible(true)

!this.select()

elseif (!message inset ('PIPE','HVACADV','HVAC')) then

-- Pipe or HVAC Application selected - show tab

!this.visible(true)

else

-- Equipment tab not required - Hide the tab

!this.visible(false)

endif

endmethod

We only want this refresh method to be called for CONTEXT events, so the command object constructor must set a context filter as follows:

define method .equipmentContextTab()

-- initialise events and command key

!this.key = 'AVEVA.Equipment.CommandContextTab'

!this.execute = 'execute'

!this.refresh = 'refresh'

!filters = object ARRAY()

!filters[1] = 'CONTEXT'

!this.refreshFilters = !filters

endmethod

The execute method for the tab command object is empty.

The message sent by a user add-in application is the key word 'Application:' followed immediately by the name of the add-in application as defined in the Name: declaration.

The following add-in file is an example of an add-in with name MYADDIN. MYADDIN will appear in the Application Selector because the showOnMenu: declaration is set to true. You have supplied an object of type MYADDINCONTROL as the control object in myaddincontrol.pmlobj which implements methods moduleStartup() and startup().

Method moduleStartup() will be called when the module starts, and it could contain PML LOAD COMMAND statements and command registration for any new functions defined for this add-in.

Method startup() is called when the application is selected in the Application Selector. This method could contain code that initializes the application.

# Description: Add-in application definition

# ---------------------------------------------------------

name: MYADDIN

CONTROL: MYADDINCONTROL

title: MYADDIN

showOnMenu: TRUE

modulestartup: !!MYADDINCONTROL.moduleStartup()

startUp: !!MYADDINCONTROL.startup()

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