![]() | Type | Description | ||
| Node as Node | A Node object being clicked. | |||
| Key as Variant | A Variant expression that indicates the key of the button inside the node being clicked. |
The following VB sample displays a message box when user clicks the 'A' button:
Private Sub Form_Load()
With XMLGrid1
.BeginUpdate
With .Editors
With .Add("Spin", SpinType)
.ButtonWidth = 18
.AddButton "A", 1
End With
End With
With .Nodes
With .Add("Spin", 1)
.Editor = "Spin"
End With
End With
.EndUpdate
End With
End Sub
Private Sub XMLGrid1_ButtonClick(ByVal Node As EXMLGRIDLibCtl.INode, ByVal Key As Variant)
If Key = "A" Then
MsgBox "You have clicked the 'A' button."
End If
End Sub
The following C++ sample displays a message box when user clicks the 'A' button:
#include "Node.h"
void OnButtonClickXmlgrid1(LPDISPATCH Node, const VARIANT FAR& Key)
{
CNode node( Node ); node.m_bAutoRelease = FALSE;
if ( V2S( &Key ) == "A" )
MessageBox( "Click the button" ) ;
}
where the VS2 function converts a VARIANT expression to a string expression:
static CString V2S( const VARIANT* pvtValue )
{
COleVariant vtString;
vtString.ChangeType( VT_BSTR, (VARIANT*)pvtValue );
return V_BSTR( &vtString );
}
The following VB.NET sample displays a message box when user clicks the 'A' button:
Private Sub AxXMLGrid1_ButtonClick(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_ButtonClickEvent) Handles AxXMLGrid1.ButtonClick
If e.key = "A" Then
MsgBox("You have clicked the 'A' button.")
End If
End Sub
The following C# sample displays a message box when user clicks the 'A' button:
private void axXMLGrid1_ButtonClick(object sender, AxEXMLGRIDLib._IXMLGridEvents_ButtonClickEvent e)
{
if (e.key.ToString() == "A")
MessageBox.Show("The user clicks the 'A' button. ");
}
The following VFP sample displays a message box when user clicks the 'A' button:
*** ActiveX Control Event *** LPARAMETERS node, key if ( key = "A" ) wait window nowait "The uuser clicks the 'A' button. " endif