2.1.26.17 tree_add_info


Description

Add all Info storage into given treenode

Syntax

bool tree_add_info(TreeNode& trNode, const OriginObject& orgObj, LPCSTR lpcszObjName = NULL, LPCSTR lpcszObjLabel = NULL, int nObjIndex = -1)

Parameters

trNode
[modify]tree node to add info storage
orgObj
[input]Origin object, can be Page, Layer, Column
lpcszObjName
[input]name of the Origin object, if NULL, will use GetName
lpcszObjLabel
[input]label of the Origin object, if NULL, will use GetLabel
nObjIndex
[input]index >= 0 for additional info to be stored in the StrData of the tree node for each item, use NPLOT_FOR_WKS if this is for text label display in a worksheet

Return

TRUE for success

Examples

EX1

void tree_add_info_ex1()
{
	Tree tr;
	Worksheet wks("Data1");
	wks.Create();
	Column cc = wks.Columns(0);
	string strName ;
	cc.GetName(strName);
	string strLabe = "Col1_Label";
	cc.SetLabel(strLabe);	
	cc.Info.Add("test");
	
	storage st;
	st = cc.GetStorage("test");
	Tree trTemp;
	TreeNode spring;
	spring = trTemp.AddTextNode("first","Spring",1);
	st.SetSection("params",trTemp);
	
	string strVal;
	if( tree_add_info(tr, cc, strName, strLabe) )
	{
		tr.A.GetAttribute(STR_LABEL_ATTRIB,strVal);
		out_str(strVal);

		TreeNode tn1, tn2;
		tn1 = tr.a.GetNode("TEST.PARAMS");
		if(tn1.IsValid())
		{
			tn2 = tn1.GetNode("SPRING");
			out_str(tn2.strVal);
		}
	}
	tr.A.Remove();
}

Remark

See Also

Header to Include

origin.h

Reference