OriginObject::DoMethod

 

Description

Execute object LabTalk methods

Syntax

int DoMethod( LPCSTR lpcszCmd, DWORD dwCntrl = 0, double * pdVal = NULL )
int DoMethod( LPCSTR lpcszCmd, LPCSTR lpcszArg, double * pdVal = NULL);

Parameters

lpcszCmd
[input] Object method name, case insensitive
dwCntrl
[input] method's input if require
pdVal
[output] return value, if index variable type, 1 offset, like Labtalk
lpcszCmd
[input] Object method name, case insensitive
lpcszArg
[input] method's input if require
pdVal
[output] return value, if index variable type, 1 offset, like Labtalk

Return

Returns 1 if lpcszCmd is a valid method and 0 if it is not. -1 if error occurs If pdVal is NULL will return the method return integer value directly

Examples

EX1

void DoMethod_ex1(string strSheetName)
{
        Page pg = Project.Pages();
        double dRet;
        int nRet = pg.DoMethod("layerNumber", strSheetName, &dRet);
        int nRet2 = pg.DoMethod("layerNumber", strSheetName);
}

EX2

void DoMethod_ex2()
{
        Worksheet wks = Project.ActiveLayer();
        int nn = wks.DoMethod("dc.Allow", 1);
        out_int("wks.dc.Allow(1) = ", nn);
}

EX3

void cpdc()
{
        WorksheetPage wp = Project.Pages();
        wp.DoMethod("cp.add", "1 40 DataConnector 3");// show Control Pane
        GETN_BOX(trTemp)
        GETN_NUM(xFrom, "X From", 1.3)
        GETN_NUM(xStep, "X Step", -0.5)
        string strxml = trTemp.XML;
        wp.DoMethod("cp.SetTree", strxml);
}

EX4

//DoMethod is implemented for Column class in 9.8b
void DoMethod_col()
{
        Worksheet wks = Project.ActiveLayer();
        Column cc(wks, 1);
        LT_set_str("%Z", "A+1");
        cc.DoMethod("SetFormula", "Z, 1");
}

Remark

See Also

OriginObject::SetProp
LT_evaluate
Layer::LT_execute

header to Included

origin.h