IForeMethods.Add

Add: IForeMethod;

Description

The Add method adds a custom method into the collection.

Example

Executing the example requires that repository contains a unit with the MY_FUNC_ASSEMBLY identifier containing the PiDiv function.

Add links to the Fore and Metabase system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    SharedParams: ISharedParams;
    Methods: IForeMethods;
    Method: IForeMethod;
Begin
    Mb := MetabaseClass.Active;
    SharedParams:= Mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit 
As ISharedParams;
    Methods := SharedParams.Methods;
    Method := Methods.Add;
    Method.Assembly := 
"MY_FUNC_ASSEMBLY";
    Method.Method := 
"PiDiv";
    Method.Category := 
"My functions";
    Method.Name := 
"PiDiv";
    Method.Description := 
"Divide value into 'Pi'";
    Method.ResultType := ForeResultType.Real;
    Method.Type := ForeMethodType.Arithmetic;
    Debug.WriteLine(
"Method key: " + Method.Key.ToString);
    (SharedParams 
As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a new PiDiv function is added into the collection of the custom methods. After that the function is available for use in various tools without any additional connection of the unit:

See also:

IForeMethods