2.2.3.17.38 TreeNode::SetDataRange

Description

Set a DataRange object to the TreeNode

Syntax

BOOL SetDataRange( DataRange & dRange, DWORD dwDisplaySettings = 0 )

Parameters

dRange
[input] the DataRange object to be assigned
dwDisplaySettings
[input] the settings used to set the strVal member of the TreeNode, see DataRange::GetDescription
can be combination of following:
GETLC_PAGE_NAME_NONE page part omitted
GETLC_PAGE_LONG_NAME, GETLC_PAGE_SHORT_NAME
GETLC_COL_SHORT_NAME, GETLC_COL_LONG_NAME
GETLC_NO_ROWS [row] part omitted

Return

TRUE is OK, otherwise failed.

Examples

EX1

// Assume there exists active worksheet with two columns.
// Fill the worksheet and columns with long name and short name.
void TreeNode_SetDataRange_ex1()
{
    
    Worksheet wks = Project.ActiveLayer();
    if ( wks )
    {
        DataRange dr;
        dr.Add("X", wks, 3, 0, 5, 1); 
 
        Tree trInput;                   	// Create a tree with a treenode
        TreeNode trRange = trInput.AddNode("Range1");
		
        DWORD dw = GETLC_PAGE_LONG_NAME|GETLC_PAGE_NAME_NONE ;//Change dw to other options to see the result
        if ( trRange )                  
            trRange.SetDataRange(dr,dw);   	//Set dr to this treenode
 
        DataRange drClone;
        if ( trRange.GetDataRange(drClone) )    //Get the data range 
            out_str("GetDataRange from treenode successfully.");
        
		out_tree(trRange);
    }
}

Remark

See Also

TreeNode::GetDataRange, DataRange::GetDescription

Header to Include

origin.h