2.2.4.32.48 OriginObject::SetProp


Description

Set object property via LabTalk property name

Syntax

int SetProp( LPCSTR lpcszVarName, double dVal )
int SetProp( LPCSTR lpcszVarName, LPCSTR lpcszVal )

Parameters

lpcszVarName
[input] Object property name, case insensitive
dVal
[input] variable value, if index variable type, 1 offset, like Labtalk
lpcszVarName
[input] Object property name, case insensitive
lpcszVal
[input] variable string value

Return

Returns 1 if lpcszVarName is a valid name and 0 if it is not. -1 if error occurs

Examples

EX1

//This example assumes the active graph has a line object
void SetProp_Ex1(int nColor = 0, string strName = "line")
{
    GraphLayer    gl = Project.ActiveLayer();
    GraphObject    grobj;
    grobj = gl.GraphObjects(strName);
    double vv;
    if(grobj)
    {
        int nn = grobj.SetProp("color", nColor);
        out_int("SetProp return: ", nn);
        out_int("new color: ", grobj.GetProp("color"));
    }
    else
        out_str("no such obj");
}

Remark

See Also

OriginObject::GetProp
OriginObject::DoMethod
LT_evaluate
Layer::LT_execute

Header to Included

origin.h