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

AVEVA™ Unified Engineering

​.NET Controls

  • Last UpdatedJun 02, 2022
  • 2 minute read

.NET controls can be hosted on a PML form. In order to do this PML provides a container gadget which can host the control. This container gadget has attributes to set and get its size and position and may be added to any PML defined form. It has similar behaviour to a Frame gadget in terms of docking, anchoring and positioning within an owning form. An instance of the .NET control is instantiated from PML. The PML container provides a method to add an instance of a .NET control to it. The .NET control may raise events which may be handled by PML. In order to customise the context menus of the .NET control from PML the ability to define a PML menu which can be shown when the .NET control raises an event is provided.

Creating a Container

A container on a form that can host the .NET control can be created in the following way in the form setup

container .exampleContainer PmlNetControl 'example' dock fill width 30 height 20

which can be docked and positioned.

Hosting .NET Control

The control may be added to the container by setting the container's control to the .NET control's handle.

using namespace 'Aveva.Core.Presentation'

!this.exampleControl = object PMLNetExampleControl()

!this.exampleContainer.control = !this.exampleControl.handle()

Events

Events on the control are supported by PML delegates already described. These allow you to add popup menus to the control for example. Events may be subscribed to by adding an event handler as follows to the .NET control

!this. exampleControl.addeventhandler('OnPopup', !this,

'rightClickGrid')

where the method to call when the event is fired is defined as follows

define method .rightClickGrid(!data is ARRAY)

!this.exampleContainer.popup = !this.examplePopup

!this.exampleContainer.showPopup(!data[0], !data[1])

endmethod

and the menu shown by the method which is added to the container is defined as follows

menu .examplePopup popup

!this.examplePopup.add( 'CALLBACK', 'Add to 3D View',

'!this.addToThreeDView()' )

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