![]() | Type | Description | ||
| Node as Node | A Node object being edited. | |||
| Cancel as Boolean | A boolean expression that indicates whether the edit operation is canceled. |
If a node has an editor assigned the node's editor is applied to the:
The edit events are fired in the following order:
Edit event. Prevents editing nodes, before showing the node's editor.
EditOpen event. The edit operation started, the node's editor is shown. The Editing property gives the window's handle of the built-in editor being shown.
Change event. The Change event is fired only if the user types ENTER key, the user selects a new value from a predefined data list, or focus a new node.
EditClose event. The node's editor is hidden and closed.
The following VB sample disables editing nodes that contain child nodes ( parent nodes ):
Private Sub Form_Load()
With XMLGrid1
.BeginUpdate
.AutoEdit = True
.Editors.Add "Edit", EditType
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
Private Sub XMLGrid1_Edit(ByVal Node As EXMLGRIDLibCtl.INode, Cancel As Boolean)
Cancel = Not Node.Nodes.Count = 0
End Sub
The following C++ sample disables editing nodes that contain child nodes ( parent nodes ):
#include "Node.h"
void OnEditXmlgrid1(LPDISPATCH Node, BOOL FAR* Cancel)
{
CNode node( Node ); node.m_bAutoRelease = FALSE;
if ( node.GetNodes().GetCount() != 0 )
*Cancel = TRUE;
}
The following VB.NET sample disables editing nodes that contain child nodes ( parent nodes ):
Private Sub AxXMLGrid1_EditEvent(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_EditEvent) Handles AxXMLGrid1.EditEvent
If (e.node.Nodes.Count <> 0) Then
e.cancel = True
End If
End Sub
The following C# sample disables editing nodes that contain child nodes ( parent nodes ):
private void axXMLGrid1_EditEvent(object sender, AxEXMLGRIDLib._IXMLGridEvents_EditEvent e)
{
if (e.node.Nodes.Count != 0)
e.cancel = true;
}
The following VFP sample disables editing nodes that contain child nodes ( parent nodes ):
*** ActiveX Control Event *** LPARAMETERS node, cancel if !( node.Nodes.Count = 0 ) cancel = .t. endif