Adding a custom control - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

When you override a display item you can override the OnConstructingControl method, and in here you can decide whether to call MyBase or not. Should you want to place your own control on the form and replace the defined one then you would not call MyBase but instead instantiate your control.

This example is in the training assembly and we override the ReasonForIssue display item.

Public Class SPFXmtlReasonForIssue

Inherits DisplayItemElement

Private mobjCustomFormControl As ReasonForIssueReplacementControl

We have our own control called ReasonForIssueReplacementControl, and then in the OnConstructingControl method we instantiate that instead of calling MyBase.

Public Overrides Sub OnConstructingControl()

'

' Commented out mybase so the core code doesn't place the normal combo control on the form.

'

'MyBase.OnConstructingControl()

'

' Create an instance of the new custom control.

'

mobjCustomFormControl = New ReasonForIssueReplacementControl

'

' Call AddCtrlToElement because it adds the control on and sorts out the resizing

'

AddCtrlToElement(mobjCustomFormControl)

End Sub