Overridable procedures

Build 1501 on 14/Nov/2017  This topic last edited on: 25/Aug/2014, at 12:00

A function or sub can be made overridable, and "modified" in a custom add-in.

This allows you to create "your version" of the system functions.

In order for this to work, the system function must be declared Overridable in the system add-ins, and your copy of the function must be declared as Overrides.

All functions that can be overridden are declared overridable in the system code. Some functions, such as Shared, cannot be declared overridable. In such case, create a variant with slightly different name in the custom add-ins and use that function.

If the function you want to override is not declared overridable in system add-ins, please report that to the support desk (support@teradp.com).

Step-by-step

1.In the system add-ins, locate the function you want to override.

2.Open the function and review its code.

3.Make note about in which system add-in it is (look at the top label), and in which class (look at the right drop-down list box). On the next figure, the current VB file is Page.vb, and the current class is PageDesignerAddIn:

override1

4.Select all the function code (from the enabler line starting with <ShellCommand(...- if any, till the last line of that function), and then press Ctrl+C to put it on the clipboard.

5.Open the appropriate custom add-in (usually the same name as the system VB file, but with the Custom prefix. In the previous example, it should be CustomPage.vb).

6.Locate the appropriate custom class (usually the same name as the class in the system VB file, but with the Custom prefix. In the previous example, it should be CustomPageDesignerAddIn).

7.Paste the code from the clipboard.

8.Replace Overridable with Overrides.

An example of overriding the ArchiveCurPage procedure in CustomPage.vb

<ShellAddIn(Version:="1.0", Description:="Page Designer AddIn")> _

Public Class CustomPageDesignerAddIn

  Inherits PageDesignerAddIn

 

'================ END OF "DO NOT MODIFY ZONE"

'----------------   start of "your custom code" zone

#Region "Overrides sub"

 

  Public Overrides Sub ArchiveCurPage()

. . .

  End Sub

 

#End Region

End Sub

'----------------   end of "your custom code" zone

End Class ' do not modify this End Class command