2.1.26.63 tree_set_attributes


Description

set the same value to all tree nodes with specified attribute by matching one another attribute of the given values

Syntax

bool tree_set_attributes( TreeNode & trDest, const vector<int> & vnAttributeVals, LPCSTR lpcszValToCopy, LPCSTR lpcszDestAttribute = NULL, LPCSTR lpcszAttributeToMatch = NULL, bool bRecursive = true )

Parameters

trDest
[modify]TreeNode copied to
vnAttributeVals
[input]The attribute value of source node used to match the attribute value of Dest node
lpcszValToCopy
[input]The value to copy
lpcszDestAttribute
[input]The attribute of target that copy source value to, if NULL, then STR_SHOW_ATTRIB is assumed
lpcszAttributeToMatch
[input]Match attribute and its value to copy, if NULL, then STR_DATAID_ATTRIB is assumed
bRecursive
[input] true, go through all the tree node in trSrc;
false, just go through the Children of trSrc

Return

false if copy none

Examples

EX1

#include <GetNBox.h>
void tree_set_attributes_ex1()
{
    GETN_TREE(myTree)            
    GETN_NUM(count, "Count", 100)    GETN_ID(2)
    GETN_CHECK(check, "Print?", 0)    GETN_ID(4)    
    GETN_STR(printed, "Printed Document", "Test1")  GETN_ID(8)
    
    vector<int> vnIDs = {4, 8};
    bool bRet = tree_set_attributes(myTree, vnIDs, "0"); //The node will be hidden that Data ID is 4, 8
    GetNBox(myTree);  //then only Count box show in dialog
}

Remark

See Also

Header to Include

origin.h

Reference