2.2.4.32.51 OriginObject::UpdateThemeIDs

Description

This method allows a tree with no theme ID to be used in ApplyFormat.

Syntax

int UpdateThemeIDs( TreeNode & trNode, LPCTSTR lpcszName = NULL, LPCTSTR lpcszValue = NULL )

Parameters

trNode
[input] Tree contains format information
lpcszName
[input] if specified and node has no ID then new attribute of that name will be added. This is used in conjuction with lpcszValue to report translation errors
lpcszValue
[input] if specified and node has no ID then new attribute of that value will be added. This is used only if lpcszName is specified to add error attributes to the tree nodes so that when function returns none-zero values, caller of this function can scan the tree to find the offending nodes.

Return

0 for no error.

Examples

EX1

void OriginObject_UpdateThemeIDs_Ex1(string strName = "Rect")
{
    GraphLayer gl = Project.ActiveLayer();
    GraphObject gg =  gl.GraphObjects(strName);
    if(gg)
    {
        Tree tr;                
        tr.Root.Fill.Color.nVal = -4; // this value corresponds to transparent, or NONE in dialog
        tr.Root.Fill.Pattern.Style.nVal = 6;
        tr.Root.Fill.Pattern.UseBorderColor.nVal = 0;// independent color for fill pattern lines
        tr.Root.Fill.Pattern.PatternColor.nVal = 6; // yellow
        tr.Root.Fill.Pattern.Width.dVal = 0.1; // fill pattern line width
        tr.Root.Fill = tr.Root.Border;
          
          int nErr = gg.UpdateThemeIDs(tr.Root);
          if(0 == nErr)
              gg.ApplyFormat(tr, true, true);
    }
}

Remark

The ApplyFormat method takes a tree with proper theme ID to make internal assignments to set various properties in an object. For an Origin C programmer, it is more friendly to deal with tag names then with theme IDs. With this method, one can construct a tree with simple a.b.c notation and call this function to prepare the tree by adding theme IDs acording to internal theme rules.

See Also

OriginObject::ApplyFormat

Header to Include

origin.h