3.7 DM_CallMethod

With this function you can call object methods from the application. The parameter values depend on the method and the object at which this method is to be called.

DM_boolean DML_default DM_EXPORT DM_CallMethod
(
  DM_ID object,
  DM_Method method,
  DM_UInt argc,
  DM_Value *argvc,
  DM_Value *retval,
  DM_Options options
)

Parameters

-> DM_ID object

This parameter describes the object whose method is to be called.

-> DM_Method method

This parameter describes the method which is to be called at this object. The following parameters of this function are assigned according to this value.

-> DM_UInt argc

This parameter specifies the number of valid method parameters.

-> DM_Value *argv

Array of DM_Value structures which include the valid parameters of the called method.

The length of this parameters has to correspond absolutely to the number given at the parameter "argc". The maximal length of this array is 8.

<- DM_Value *retval

Pointer to a DM_Value structure which is used by this function as return value.

An element is set in this structure according to the called method.

-> DM_Options options

You can specify the option DMF_DontFreeLastStrings to keep the memory of the string parameters valid.

Return Value

TRUE

Method was carried out successfully.

FALSE

Method was not carried out successfully.

At present, the following methods exist:

Object

Method

C Constant

tablefield

clear

MT_clear

 

insert

MT_insert

 

delete

MT_delete

 

exchange

MT_exchange

Example

Unloading a tablefield in a reloading function .

void DM_CALLBACK ContFunc (DM_ContentArgs* args)

{

    DM_Value methArgs[2];

    DM_Value retval;

    DM_Value first, last;

    ushort ldStart, ldCount;

    ushort visStart;

 

    ldStart = args->loadfirst - args->header;

    ldCount = args->loadlast - args->loadfirst + 1;

 

    visStart = args->visfirst - args->header;

 

    if (visStart > 20)

    {

        /*

        *  On loading, two parameters have to be

        *  specified for the method.The start has to

        *  take place and end index between which the

        *  deletion has to take place. Both of them

        *  have the datatype integer.

        */

        methArgs[0].type = DT_integer;

        methArgs[1].type = DT_integer;

        methArgs[0].value.integer = args->header + 1;

        methArgs[1].value.integer = visStart - 20;

        DM_CallMethod(args->object, MT_clear, 2, methArgs,

             &retval, 0);

    }

}