2.2.4.32.3 OriginObject::AttachXFunction

Description

Attach an X-Function to the graphic object.

Syntax

BOOL AttachXFunction( LPCSTR lpcszName, TreeNode & treeUserData = NULL, int nIndex = 0, DWORD dwCntrl = OCD_INITDATA )

Parameters

lpcszName
[input] The name of the X-Function to attach.
treeUserData
nIndex
dwCntrl
[input] control bits on the attach, must have OCD_INITDATA for most cases for the object to properly initialize.
if OCD_INITDATA is not specified, then only the name is stored into the object and no action is taken to initialize

Return

TRUE if the named function is attached to the graphic object else FALSE.

Examples

EX1

// Sample expects a graph to be active and accepts the name of a graphic object (which must exist)
// and the name of an XFunction appropriate to that object. For example :
// OriginObject_AttachXFunction_Ex1(Rect, curve statistics)
// attaches the "curve statistics" function to an object named "rect"
void OriginObject_AttachXFunction_Ex1(string strObjName, string strXFuncName)
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
    {
        GraphObject grobj = gl.GraphObjects(strObjName);
        if(grobj)
        {
            if(grobj.AttachXFunction(strXFuncName))
            {
                out_str("XF attached");
                return;
            }
        }
    }
    out_str("Attach failed");
}

Remark

See Also

Header to Include

origin.h