Creating Custom Class Objects

Custom class objects are created in the object navigator as other repository objects. To do this, in the navigator's context menu and in the drop-down menu of the New Object button in the Create group on the Home ribbon tab select the User Objects subgroup of commands.

NOTE. Creating custom class objects is available only in the desktop application.

The further work with custom class objects is fully done via the Fore language. Properties and methods of accessing a custom class object are contained in the IMetabaseCustomObject interface. A custom class object can contain any data. Consider simple examples for writing data to a custom class object and reading data from it. Data will be read or written from or to file:

Write data to custom class object

Read data from custom class object

Executing Operations

In order the working with custom class objects in the object navigator matches working with other repository objects, create a list of operations in class settings and specify the handler that contains class with implementation of operations. For example, the class implementation that is used to handle standard operations Open, Edit and two more operations is the following:

Class with operations

To write or read data in custom class objects, the above mentioned operations can be written to events handlers:

Read or write data

Parametric Custom Class Objects

If required, custom class objects can be converted into parametric ones. To do this, via Fore fill in the IMetabaseObjectDescriptor.Params collection. The following code can be used to create parameters:

Create parameters

Before executing the operation, the Determine Parameter Values dialog box opens for parametric object. After the values are entered and the OK button is clicked, the corresponding handler method is called. If the Cancel button is clicked in the dialog box, the handler is called but it passes empty parameter values.

The corresponding handlers must be implemented to handle operations of parametric objects:

Class with operations

See also:

Creating Custom Classes