event AddNode (NewNode as Node)
Occurs when a node is added to the nodes collection.

 TypeDescription 
   NewNode as Node A Node object being inserted.  
The AddNode event notifies your application that user adds a new node. Use the Add method to insert a new node to the Nodes collection. Use the Nodes property to access the control's nodes collection. Use the AddNode event to associate extra data to the newly inserted node. Use the Add method to add new type of editors to the control. Use the Editor property to assign an editor to a node.

The following VB sample assigns a default editors to all nodes, using the AddNode event:

Private Sub Form_Load()
    With XMLGrid1
        .BeginUpdate
        
        With .Editors
            With .Add("Edit", EditType)
                .Appearance = SingleApp
            End With
        End With
        
        With .Nodes
            With .Add("Root").Nodes
                .Add "Child 1", "text1"
                .Add "Child 2", "text2"
            End With
        End With
        .EndUpdate
    End With
End Sub

Private Sub XMLGrid1_AddNode(ByVal NewNode As EXMLGRIDLibCtl.INode)
    NewNode.Editor = "Edit"
End Sub

The following C++ sample assigns a default editors to all nodes, using the AddNode event:

#include "Node.h"
void OnAddNodeXmlgrid1(LPDISPATCH NewNode) 
{
	CNode node( NewNode ); node.m_bAutoRelease = FALSE;
	node.SetEditor( COleVariant( "Edit" ) );
}

The following VB.NET sample assigns a default editors to all nodes, using the AddNode event:

Private Sub AxXMLGrid1_AddNode(ByVal sender As System.Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_AddNodeEvent) Handles AxXMLGrid1.AddNode
    e.newNode.Editor = "Edit"
End Sub

The following C# sample assigns a default editors to all nodes, using the AddNode event:

private void axXMLGrid1_AddNode(object sender, AxEXMLGRIDLib._IXMLGridEvents_AddNodeEvent e)
{
	e.newNode.Editor = "Edit";
}

The following VFP sample assigns a default editors to all nodes, using the AddNode event:

*** ActiveX Control Event ***
LPARAMETERS newnode

with newnode
	.Editor = "Edit"
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.