2.1.26.58 tree_one_treetable_to_str


Description

This function will construct current treeNode to table format string, after this can printf treenode as table in scrip window and note.

Syntax

string tree_one_treetable_to_str( TreeNode & trNode, vector<int> & vnDisplayFormat, bool bSkipHidden, bool bTranspose = true, int nXoffset = 0, int nExtraSpace = 1, bool bLev1AsCols = true, string strDoubleValueFormat = "*" )

Parameters

trNode
[input]TreeNode want to construct as table string.
vnDisplayFormat
[input]display format of column header, row header and cell , can be DISPLAY_LEFT, DISPLAY_CENTER, DISPLAY_RIGHT
bSkipHidden
[input]If true, will skip the hidden treeNode.
bTranspose
[input]If true, the treeNode first level as row, second level as column.
nXoffset
[input]Offset of first row.
nExtraSpace
[input]extra space between tow column.
bLev1AsCols
[input]if true the treeNode's first level will show as column name, else show "Col" + n as column name.
strDoubleValueFormat
[input]LabTalk formatting string, default (NULL) will use "*"

Return

Table string of the TreeNode.

Examples

EX1

void tree_one_treetable_to_str_ex1()
{
    Tree trd;
    TreeNode tr = trd.AddNode("Temp");
    
    TreeNode trFirstRow = tr.AddNode("FirstRow");
    
    TreeNode trFirst = trFirstRow.AddNode("First");
    trFirst.strVal = "Hello";
    TreeNode trSecond = trFirstRow.AddNode("Second");
    trSecond.strVal = "Hi";
    
    TreeNode trSecondRow = tr.AddNode("SecondRow");
    TreeNode trThird = trSecondRow.AddNode("First");
    trThird.strVal = "world";
    TreeNode trFourth = trSecondRow.AddNode("Second");
    trFourth.strVal = "Hi";
    vector<int> vnTableDisplayFormat = { DISPLAY_CENTER, DISPLAY_RIGHT, DISPLAY_RIGHT};
    string strTreeTable = tree_one_treetable_to_str(tr, vnTableDisplayFormat, true);
    out_str(strTreeTable);    
}

Remark

See Also

Header to Include

origin.h

Reference