TreeListNodeInsert

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

SalNumber TreeListNodeInsert( SalNumber nNodeType,
		           SalNumber hItemParentNode,
		           cMessage msgNodeData,
		           SalBoolean bLeafNode )

The TreeListNodeInsert method inserts a new node of a specified type in the tree list box.

Parameters

Name Description
SalNumber nNodeType The node type of the node to be inserted
SalNumber hItemParentNode Handle of the item under which the new node should be inserted. For most Const.PM_TreeList* messages the item handle is sent in the lParam parameter.
cMessage msgNodeData Data for the node to be inserted. The cTreeListBox class does not care what attributes you specify in this parameter - it will simply keep track of them for you so that you can use them later. However the attribute specified as 'display attribute' must always be included.
SalBoolean bLeafNode Specify TRUE if the node inserted is a leaf node (has no children), FALSE otherwise.

Returns

The return value is the item handle of the inserted item.

Example

Select Case nNodeType
   Case TREELIST_NodeTypeRoot
       ! Add nodes of the type '1' which is the COMPANY object
       Call DbPrepareAndExecute( c_hSql,'select name,company_id
          from demo_company
          into :i_hWndFrame.frmTreeListBox.sOutput,
          :i_hWndFrame.frmTreeListBox.sCompany_id')
       While DbFetchNext(c_hSql,nFetch)
          Call NodeInfo.Construct( )
          Call NodeInfo.SetName( sCompany_id )
          Call NodeInfo.AddAttribute( 'NAME', sOutput )
          Call NodeInfo.AddAttribute( 'COMPANY_ID', sCompany_id )
          Call lbCompanyTree.TreeListNodeInsert( 1, hItem, NodeInfo, FALSE )
       Break
C# coding.
case 0:
sProjectIdCurrent = lbSubProjects.TreeListNodeIdFromItem(hItem);
// Insert all public categories
DbPrepareAndExecute(cSessionManager.c_hSql,"Select SUB_PROJECT_ID,DESCRIPTION INTO\r\n"+
	":i_hWndFrame.frmProjectInfoStructure.sSubProjectId1, 
:i_hWndFrame.frmProjectInfoStructure.sDescription1 \r\n" + "FROM &AO.SUB_PROJECT\r\n" + "where project_id = :i_hWndFrame.frmProjectInfoStructure.sProjectIdCurrent
and parent_sub_project_id IS NULL"); while (DbFetchNext(cSessionManager.c_hSql, ref nFetch)) { Msg.Construct(); Msg.SetName(sSubProjectId1); Msg.AddAttribute("DESCRIPTION", sSubProjectId1 + " " + sDescription1); lbSubProjects.TreeListNodeInsert(1, hItem, Msg, false); }