OriginObject::GetProp

 

Description

Get object property via LabTalk property name

Syntax

int GetProp(LPCSTR lpcszVarName, double * pdVal = NULL)
int GetProp(LPCSTR lpcszVarName, string & str )

Parameters

lpcszVarName
[input] Object property name, case insensitive
pdVal
[output] resulting value, if index variable type, 1 offset, like Labtalk. NULL will return as integer directly
lpcszVarName
[input] Object property name, case insensitive
str
[output] resulting string

Return

Returns 1 if lpcszVarName is a valid name and 0 if it is not. -1 if error occurs
If pdVal is NULL will return the object property integer value directly
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 GetProp_Ex()
{
        GraphLayer gl = Project.ActiveLayer();
        if( gl.IsValid() )
        {
                GraphObject     go;
                go = gl.GraphObjects("Line");
                if( go.IsValid() )
                {
                        double vv;
                        int nn = go.GetProp("color", &vv);
                        printf("ret = %d, color = %g\n", nn, vv);
                        out_int("can also directly get integer return value: ", go.GetProp("color"));
                        
                        Tree trColor;
                        trColor=go.GetFormat(FPB_STYLE_COLOR, FOB_OBJECT, TRUE, TRUE);
                        out_int("trColor.Root.Color.nVal=", trColor.Root.Color.nVal);
                }
        }
}

Remark

See Also

OriginObject::SetProp
LT_evaluate
Layer::LT_execute

header to Included

origin.h